使用FFmpeg合并具有不同timtim距离的图像 [英] Using FFmpeg to join images with different timly distance
问题描述
我有一组图像,尝试从中创建幻灯片.在这个网站上,我发现可以使用以下命令:
ffmpeg -framerate 1/5 -start_number 126 -i img%03d.png -c:v libx264 -r 30 -pix_fmt yuv420p out.mp4
我知道它工作正常.但就我而言,我需要让每个图像显示不同的时间.我该如何实现?
您可以尝试使用concat多路分配器,并提供每帧的持续时间.
-
制作文本文件,其中包含输入路径以及每个输入的持续时间:
file '/path/to/image0.png' duration 2 file '/path/to/image1.png' duration 5 file '/path/to/image2.png' duration 1.5 file '/path/to/image3.png' duration 4
-
然后运行
ffmpeg
:ffmpeg -f concat -i input.txt -pix_fmt yuv420p -movflags +faststart output.mp4
注意:
-
有关详细信息,请参见 concat多路分解器文档.
p>
-
该示例不适用于旧版
ffmpeg
,因此请确保下载由于FFmpeg的开发非常活跃,所以最近才建立了最新版本.
I have a set of images from which I try to create a slide show. On this website I found the following command to do so:
ffmpeg -framerate 1/5 -start_number 126 -i img%03d.png -c:v libx264 -r 30 -pix_fmt yuv420p out.mp4
I got it working fine. But in my case I need to have each images to be displayed a different period of time. How can I achieve this?
You can try the concat demuxer and provide the duration for each frame.
Make text file containing the path to your inputs and the duration for each:
file '/path/to/image0.png' duration 2 file '/path/to/image1.png' duration 5 file '/path/to/image2.png' duration 1.5 file '/path/to/image3.png' duration 4
Then run
ffmpeg
:ffmpeg -f concat -i input.txt -pix_fmt yuv420p -movflags +faststart output.mp4
Notes:
See the concat demuxer documentation for more info.
The example won't work with an old
ffmpeg
, so make sure to download a recent build first since FFmpeg development is so active.
这篇关于使用FFmpeg合并具有不同timtim距离的图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!