Log in

View Full Version : Variable Frame Rate Confusion


Makaveli84
27th June 2012, 14:47
I'm not sure that this subject necessarily belongs here, but i am mostly interested in h264 videos with VFR, although my question is about VFR in general.

So i've been reading and searching around, trying to understand more about the notion of VFR videos, and i came to see that there is a lot of confusion regarding this matter. My understanding regarding a VFR video is the following:

- Ususally, barring Broadcast and Transport Streams, actual video streams don't carry in their header any info regarding the frame rate, or if they do, this info is usually disregarded by soft and hard players alike, which instead look for this info in the container.

- In the case of an actual VFR video, the actual container header info carries a normal Frame Rate setting like a CFR video (say 23.976 fps). However, an additional Time Code file is attached or muxed with the video stream within the container. This Time Code file specifies which parts of the stream should be played at which frame rate. Then, it's on the decoder end to honor this piece of info, or else, the video will not be properly synced with the audio.

- If a video marked as VFR can be simply remuxed into a CFR one without losing audio sync, then this is not an actual VFR. I raise this point because i find lots of videos and muxing programs that use the "VFR" label in a rather liberal way. For example, i can have the same video and audio streams remuxed from MKV to MP4 and vice versa using different tools, with no Time Codes attached to any of the streams or muxed into the container at any point, and the resulting video files will be labeled as VFR or CFR, although they have the same times and no playback or sync issues at all. FFmpeg and MKVMerge seem to yield VFR videos more often then not, whilst MP4Box in CLI or through MyMp4BoxGUI seems to yield a CFR video for example.
Surprisingly, a GUI tool called MkvToMp4 gives me an option to choose between VFR and CFR when remuxing an MKV into MP4. Both videos though have the same length and play with no problems, although MediaInfo seems to differentiate between them as intended (the VFR is found to have Variable Frame Rate, and the CFR one is found to have Constant Frame Rate).


All this seems pretty confusing to me. Help!

Makaveli84
7th July 2012, 12:22
And here i was thinking some of the experts could explain VFR to me...
:rolleyes:

sneaker_ger
7th July 2012, 12:58
The thing is that CFR is a special case of VFR.

- In the case of an actual VFR video, the actual container header info carries a normal Frame Rate setting like a CFR video (say 23.976 fps). However, an additional Time Code file is attached or muxed with the video stream within the container. This Time Code file specifies which parts of the stream should be played at which frame rate. Then, it's on the decoder end to honor this piece of info, or else, the video will not be properly synced with the audio.

This is format dependent. MKV does not have any header information telling you whether the file is VFR or CFR (H.264 bitstream does, though. But again: sometimes CFR videos get encoded with VFR header). Also, timecodes are not "attached in case of VFR", but are always present in the file. If a program wanted to test a file for VFR, it would have to parse it completely (and even then it's not 100% correct, because of the limited precision of the timecodes. Theoretically, there is no constant 23.976 fps in mkv).

Selur
13th July 2012, 09:42
only way to check if your video is vfr or not is to check the time codes (limited precision of the time codes aside).

Personally I do the following:
1. extract time codes (t1 ... tn)
2. analyze Time codes: calculate average time code difference (difference between two time codes) and assume vfr, if tj-ti differs more than two ms from the average

Cu Selur