FFMPEG : custom sequence input images

后端 未结 2 1211
情书的邮戳
情书的邮戳 2021-01-15 11:24

I created a video from a set of images.

The command look like:

ffmpeg -i bg.jpeg -i img_%d.png -filter_complex overlay=5:H-h-5[b]-shortest testvid.mp         


        
相关标签:
2条回答
  • 2021-01-15 11:54

    You can use the concat demuxer with the custom sequence.

    First, create a text file:

    file 'img_0.png'
    file 'img_1.png'
    file 'img_1.png'
    file 'img_2.png'
    file 'img_1.png'
    file 'img5.png'
    file 'img_4.png'
    

    Then run

    ffmpeg -i bg.jpeg -f concat -r 25 -i list.txt -filter_complex "overlay=5:H-h-5" -shortest out.mp4
    

    Edit: For PNG and most other image formats, r should be expressly specified to initialize a duration for each image entry in the list.

    0 讨论(0)
  • 2021-01-15 11:54

    I just had the same issue, and if you have the need to generate image list as a part of program execution, then consider adding a duration <sec> string after every file <path> line, which will make the filter infer DTS. Like below:

    file 'img.00000020.png'
    duration 0.03333
    file 'img.00000021.png'
    duration 0.03333
    ...
    

    For the case of offline conversion of a bunch of images, inline globbing worked just fine (so yes - DTS errors come from concat filter), but the following bash command can provide a list for the dry run:

    for i in img.*.png; do echo file \'$i\'; echo duration 0.03333; done > list.txt
    
    0 讨论(0)
提交回复
热议问题