0

I have a H264 video source that was recorded with variable framerate (VFR) and a text file with frame ID, timestamp pairs that looks like this:

frameId,timestamp
1890413473,13792093
1890413474,13792106
1890413475,13792123
1890413476,13792139
...

If I try to playback as is, it defaults to the 25 constant framerate (CFR) ffmpeg -i stream.h264 -c copy stream.mkv

How do I combine the timestamp data to make a .mkv playing at the appropriate rate? The docs have -vsync vfr which looks related, but not sure about the input format for the times to sync with.

  • See stackoverflow.com/a/37893746 – Gyan Mar 26 at 15:57
  • I wrapped the h264 in an mp4 container and changed the text file to the timecode v2 format. Then the mp4fpsmod was able to make the correct VFR video. I was able to do a similar thing with mkvmerge to work with mkv containers. – Phoenix Mar 28 at 16:54
  • However, is there a way for ffmpeg to do this or be more attuned to it? For instance if I try to convert the corrected vfr video to another format ffmpeg -i stream_vfr.mp4 -c copy stream.mkv I get mismatch values between pkt_duration, pkt_dts from the original from ffprobe -show_frames – Phoenix Mar 28 at 21:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.