Log in

View Full Version : Using mediainfo, how should I calculate video bit rate?


frobber
3rd February 2025, 07:32
I'm writing some code that needs to parse the output of mediainfo, to get the video bit rate.

I'm asking mediainfo for JSON, and getting over 100 tracks (there seem to be lots of extras on this DVD).

To simplify, I look for the IFO with the longest duration and work from there (assuming that's the "main" title).

The IFO itself has an "OverallBitRate" but the value is very small, e.g. "29". There are several VOBs associated with this IFO, but each one has a slightly different "OverallBitRate", and there are some super-short tracks that have a very different bit rate (e.g., 400 ms duration, with a bit rate that's 1/3 of the other VOBs). Some have a "BitRate" and some have a "BitRate_Maximum", so I'm a little confused by all these different values.

Is there some kind of rule for how this should be calculated ?

TIA !

Emulgator
3rd February 2025, 16:30
PGCDemux, ffprobe.

frobber
4th February 2025, 00:11
Thanks. Unfortunately, PGCDemux only runs on Windows, and for my use case it is too slow to demux every DVD for this.

I just tried ffprobe, and AFAICT it will only read VOB files, and then it reports the same info, i.e., different bit rates, depending on the VOB.

So, I feel mediainfo is still the way to go.... but how to calculate the bit rate?

Asmodian
4th February 2025, 18:59
how to calculate the bit rate?

Average, weighted by duration.

frobber
5th February 2025, 01:03
Average, weighted by duration.

Thanks. What do you mean "weighted by"? Sorry, I don't follow.

FWIW, examining the mediainfo more closely, I see now that only the General sections have an OverallBitRate, and only some of the Video sections have a BitRate. It looks like OverallBitRate actually expresses both Audio and Video, because it appears even where then is no BitRate information recorded for a Video section.

huhn
5th February 2025, 03:06
stream size or Bits/(pixel*frame) rest is simple math.