Tech Support > Computer Hardware > Desktops > Detecting VBR vs CBR in MPEG-2 from headers and trace files
Detecting VBR vs CBR in MPEG-2 from headers and trace files
Posted by John Bartley K7AAY on March 19th, 2008


I need to search through headers and trace files for thousands of
video files to determine if an MPEG-2 file was encoded with Constant
Bit Rate or Variable Bit Rate, through an automated process. I've
already done that with H.264, where it was easy with
[SPS] cbr_flag = 0
but the standards document for MPEG-2 indicates the content of
bit_rate_value won't tell me if a file's VBR or CBR, and there's no
other flag I can see which might.

Mediainfo is not reliable; it identifies VBR files as CBR.

How may I look into an MPEG-2 file and determine if it's CBR or VBR?

Thank you kindly.

Posted by John Bartley K7AAY on March 20th, 2008


Solution, I think....

grep vbv_delay (tracefile) | awk '{print $5}' | sort | uniq | awk
'END{print NR-1}'
will return 0 if CBR, 1 or higher if the bit rate varies. So, perhaps
that's my solution?

If that looks bogus, your feedback would be appreciated.

I use the GNUWIN32 versions of grep and awk, uniq from Jason Mathews
and sort from Microsoft Windows, if you want to replicate my test.



On Mar 19, 4:46 pm, John Bartley K7AAY <john.bart...@gmail.com> wrote:


Similar Posts