Can I create a VFR video from timestamped images?

妖精的绣舞 提交于 2019-12-06 05:59:16

问题


First, I have almost zero experience in making videos from images.

What I have is a set of BMP timestamped images from which I want to generate a video. Since the timestamps are not equally spaced, I cannot simply use software that create constant-frame-rate videos from images.

A possible solution would be to create artificial images at fixed time intervals, but I prefer to leave that as a last resort if I fail to make a VFR video.

Any suggestions on how to achieve what I want?


回答1:


You can use a combination of two tools to do this: ffmpeg and mp4fpsmod

Step 1 is to generate a constant frame rate file using ffmpeg

ffmpeg -i images%d.bmp -pix_fmt yuv420p ffmpeg-cfr.mp4

Step 2 is to generate a timecode file like the one below, with each line containing the relative timestamp for a frame in milliseconds.

# timecode format v2

0
33
88
100
120
160
200
230
330
347

Step 3 is to use mp4fpsmod to generate the VFR file

mp4fpsmod -o vfr.mp4 -t timecodes.txt ffmpeg-cfr.mp4 

This file plays as expected with ffplay but may not with some players, in which case run

Step 4 Generate a CFR MP4 from the VFR using FFmpeg

ffmpeg -i vfr.mp4 final-cfr.mp4

This is a CFR file but the temporal relations are preserved as per the VFR, although there will be some PTS adjustments, if the timecode intervals are very irregular. That can be remedied by specifying a high framerate -r N




回答2:


Take a look at this link. http://avisynth.nl/index.php/VFR#encoding_to_vfr_.28mkv.29

It might be a little outdated now, as you now do the process of importing the timecode format file from mkvtoolnix (instead of mkvmerge), but it should let you do it.



来源:https://stackoverflow.com/questions/28086775/can-i-create-a-vfr-video-from-timestamped-images

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!