[MEncoder-users] B Frames and mp4

Corey Hickey bugfood-ml at fatooh.org
Tue Apr 15 00:58:43 CEST 2008


Alex Samad wrote:
> There has been a lot of talk about Bframes (and one other type that
> escapes me right now), how can I tell from a .mp4 file weather there are
> B Frames being used, something like mplayer -v <file> ?

As far as I understand, it's possible for a video stream to have
B-frames enabled (low_delay=0) but not actually have any B-frames
present. The only sure way is to scan the entire file; however, in most
sane cases, B-frames will be present near the beginning or not at all,
so feel free to add '-frames 100' or something to the following command:

mplayer <some_file> -nosound -vo null -benchmark -v -lavdopts debug=1 \
2>/dev/null

This will print out lines beginning with:
[h264 @ 0x101c480]slice:1 F mb:0 B pps:0 frame:6 poc:18/18 ref:5/1...
                                 ^ so, this is a B-frame


You can pipe the lines to something to count frames for you. The
following quick-n-dirty perl should work for mplayer's output when
playing MPEG-4 and H.264. Try piping the above command into this:

perl -e 'while(<>) { ++$f{$2} if /\[(h264|mpeg4).*?([PIB])/ }'\
' print "I-frames: $f{I}\nP-frames: $f{P}\nB-frames: $f{B}\n"'


-Corey



More information about the MEncoder-users mailing list