问题描述
如何使用ffmpeg从10张图片中创建mpg/mp4文件.
How can I create a mpg/mp4 file from let's say 10 images using ffmpeg.
每张图片应停留5分钟,超过5分钟后,将出现下一张图片,依此类推....
Each image shall stay for 5 minutes, after the 5 minutes are over the next image shall appear and so on....
我该如何实现?
推荐答案
如果您的图像按序列编号(img001,img002,img003 ..),请使用
If your images are numbered in a sequence (img001, img002, img003..), use
ffmpeg -framerate 1/300 -i img%3d.jpg -r 5 video.mp4
(出于播放器兼容性的考虑,我将输出帧速率设置为5.每个图像仍会保留300秒)
(I've set an output framerate of 5 for player compatibility. Each image will still remain for 300 seconds)
如果文件名不规则,并且正在bash之类的Unix shell中执行,则可以运行
If your filenames are irregular, and you are executing in a Unix shell like bash, you can run
ffmpeg -framerate 1/300 -pattern_type glob -i '*.jpg' -r 5 video.mp4
对于MPEG-2,
For MPEG-2,
ffmpeg -framerate 1/300 -i img%3d.jpg -c:v mpeg2video -b:v 2000k -r 5 video.mpg
不知道MPEG-2预期的最低输出帧速率是多少.实验.
No idea what minimum output framerates are expected of MPEG-2. Experiment.
这篇关于FFmpeg将图像合并到视频的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!