使用FFmpeg合并具有不同timtim距离的图像 [英] Using FFmpeg to join images with different timly distance

查看:100
本文介绍了使用FFmpeg合并具有不同timtim距离的图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一组图像,尝试从中创建幻灯片.在这个网站上,我发现可以使用以下命令:

ffmpeg -framerate 1/5 -start_number 126 -i img%03d.png -c:v libx264 -r 30 -pix_fmt yuv420p out.mp4

我知道它工作正常.但就我而言,我需要让每个图像显示不同的时间.我该如何实现?

解决方案

您可以尝试使用concat多路分配器,并提供每帧的持续时间.

  1. 制作文本文件,其中包含输入路径以及每个输入的持续时间:

    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
    

  2. 然后运行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.

  1. 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
    

  2. 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆