[Matroska-devel] requesting "AvgTimePerFrame" or "FieldRate" header field
madshi at gmail.com
Wed Dec 5 12:21:58 CET 2012
currently I'm missing a dedicated "AvgTimePerFrame" or "FPS" header field
in the MKV spec. There is a "DefaultDuration" field, but it can't be
reliably used to detect the FPS of the video track.
First of all let me explain *why* I need FPS information: My DirectShow
video renderer (madVR) has a built in display mode / refresh rate changer
which automatically adjusts the GPU display mode / refresh rate to match
the movie. This is done to achieve smooth playback results, because
obviously a 24p movie should be played with e.g. 1080 at 24Hz display mode,
while for 25p movie playback 1080 at 50Hz is more appropriate. I need to know
the FPS of the movie right at the start of playback because changing
display modes in the middle of playback is just not acceptable for a good
There are various tricks to try to detect the FPS information without
having a dedicated FPS field. E.g. I could parse the video bitstream to
look for FPS information there. Or I could try to interpret
"DefaultDuration". Or I could look at the timestamps and try to get the
information from there. But this is all a lot of guess-work and might fail
in certain situations. E.g. the video bitstream FPS information might not
match the container timestamps, so I can't use that. The "DefaultDuration"
field is somewhat a matter of interpretation, so I can't use that in any
reliable way, either. For example, if half of the MKV blocks have a single
interlaced field in them while the other half of the MKV blocks have a
frame (interlaced field pair) in them, there's no way to know for sure
which value the muxer used for "DefaultDuration". It could be 20ms or 40ms.
So if DefaultDuration is e.g. 20ms, the file could still be either 25p or
50p. Trying to interpret the container timestamps is difficult, too,
because depending on the I/P/B frame structure, the timstamps could jump
back and forth, and the muxer might not have done such a great job with
creating proper and reliable container timestamps, so in order to get a
really reliable guess a lot of timestamps would have to be looked at first,
and even then it would still be a guess.
At the moment, all MKV DirectShow splitters (that I know of) simply read
"DefaultDuration" and pass that on as the FPS. That works fine for many
files, but not for all. So I believe we really need a dedicated frame rate
field (similar to the header fields available in h264, MPEG2, VC-1 etc.) to
stop the confusion and guess-work. Of course the field would be optional,
and should be left undefined for true VFR content.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Matroska-devel