1. 任务描述:由给定图像序列合成 24fps 视频
方案一
直接对图像进行操作,适用于图像名比较规范且默认顺序即为所需顺序的情景
ffmpeg -f image2 -i ./images_crop_%d.png -pix_fmt yuv420p -vcodec libx264 -r 24 -y output.mp4
方案二
将图像顺序写入一个文件列表,让 ffmpeg 从列表读入并合成视频,适用于自定义图像顺序的情景
ffmpeg -f concat -safe 0 -i input.txt -pix_fmt yuv420p -vcodec libx264 -r 24 -y -an output.mp4
其中列表格式如下
file '/Users/cv/playground/data/cam_1_frame_00.png' duration 0.5 file '/Users/cv/playground/data/cam_2_frame_01.png' duration 0.5 ……