4

For example, I have a video for which ffmpeg shows

  Duration: 00:46:43.72, start: 0.540000, bitrate: 2593 kb/s
    Stream #0.0[0x1e0]: Video: mpeg2video (Main), yuv420p, 720x576 [PAR 16:15 DAR 4:3], 9000 kb/s, 25 fps, 25 tbr, 90k tbn, 50 tbc
    Stream #0.1[0x80]: Audio: ac3, 48000 Hz, stereo, s16, 448 kb/s

The size of the file is 908843008 bytes, so the 2593 kb/s is correct. But why does it say that the video stream bitrate is 9000 kb/s?

2 Answers 2

5

MPEG streams typically use variable bitrate encoding in order to save space in sections of the video that are easy to encode, thus allow increased quality. FFMpeg is reporting the bitrate stored in the video stream's sequence header, which is the maximum bitrate in the entire file (or, in many cases, the maximum bitrate the encoder was configured to allow -- the actual file may not have any sections that use as high a bitrate as this). The value 9000kbps is typical of MPEG2 streams from (or destined for) DVDs: DVDs have a maximum combined video & audio bitrate of 9800kbps, so this allows ~500kbps for audio and some spare for navigation packets & other overhead.

1
  • Thanks! This was indeed encoded by ffmpeg with -target pal-dvd.
    – Prateek
    Commented Dec 28, 2013 at 11:01
2

In general, ffmpeg uses file headers for information where it can (when it recognises header formats), and otherwise falls back to calculating it from duration and file size.

Wrapper formats (eg. mov, mp4) don't have a bitrate of their own - the bitrate is a characteristic of the individual streams - but it would have a duration. ffmpeg can then calculate the bitrate from filesize and duration.

The streams themselves, however, will have a bitrate specified in the stream headers, so it can be read straight from the metadata. This means the bitrate may be specified wrongly in the header, or it may be 9000kb/s at the start, and decrease to a lower bitrate, or the stream may be truncated so that the file is not complete, hence the maths not working as expected.

If you extract the video component (eg: ffmpeg -i myfile.mov -vcodec copy -an testfile.m2v, usage varies with software versions), you may be able to investigate further and work out where the bitrate shown is coming from.

1
  • 3
    The 9000 figure is produced at the start, probably by a streaming encoder that never goes back and fixes it. It is a theoretical maximum, to tell the receiver "if you allocate enough memory for this, you'll be able to play the entire file".
    – Jules
    Commented Dec 28, 2013 at 10:18

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .