2

I have an audio file and if I run ffprobe on it, I get:

  Duration: 00:03:11.17, start: 0.000000, bitrate: 129 kb/s
    Stream #0:0(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 128 kb/s (default)

Note the two bitrate values: I would like to know why there are two and what they are?

Here they are close but not identical. In other audio files, the two are identical. In other cases they are widely different:

Input #0, ogg, from 'Oxygen-Sys-Warning.ogg':
  Duration: 00:00:02.07, start: 0.000000, bitrate: 159 kb/s
    Stream #0:0: Audio: vorbis, 48000 Hz, stereo, fltp, 192 kb/s
Input #0, ogg, from 'Oxygen-Window-All-Desktops-Not.ogg':
  Duration: 00:00:00.60, start: 0.000000, bitrate: 112 kb/s
    Stream #0:0: Audio: vorbis, 44100 Hz, mono, fltp, 96 kb/s

If I want to run a filter on an audio file, I want to output a file with identical sampling rate and bitrate, so I want to know which is the correct bitrate and why two are displayed.

jamadagni
  • 317

1 Answers1

3

The difference between the first bitrate (from Duration:) and the second one (from Stream:) is that the first one is the division of the total file size (including headers and metadata) by the probed media duration. The second one is the division of the media data size by the probed media duration. Both are only approximations.

If you want the actual bitrate of the audio stream, you'll need to parse it:

ffmpeg -i file -c copy -map 0:a -f null -

Note above down the audio stream size on the last line next to audio: and the duration on the line above it next to time=. Divide the first by the second to get the average bitrate of the stream.

If you want the notional bitrate i.e. the target set for the encoder, then it's the reading for the Stream.

However, you don't need to specify only one bitrate. For specifying differing target bitrates for video and audio, see the post How to specify audio and video bitrate. See also FFmpeg wiki: Limiting the output bitrate for the bufsize parameter.

harrymc
  • 498,455