dimanche 4 octobre 2015

How to correctly combine FFMPEG file pattern and complex filter?

Say I have the following FFMPEG command line using the built-in filters.

ffmpeg -y -loop 1 -t 1 -i 'img-0001.jpg' -loop 1 -t 1 -i 'img-0002.jpg' \
-filter_complex "\
[1:v][0:v]blend=all_expr='A*(if(gte(T,0.7),1,T/0.7))+B*(1-(if(gte(T,0.7),1,T/0.7)))'[b1v]; \
[0:v][b1v][1:v]concat=n=3:v=1:a=0,format=yuv420p[v]" \
-map "[v]" out.avi

What it does is to display the two input images img-0001.jpg and img-0002.jpg for one second each and also blending between them. Unfortunatly this will break at some point when I want to create a slide show with a lot of images. You will get an "Argument list too long" error. So I wanted to use ffmpegs file pattern syntax, i.e., something like

ffmpeg -y -loop 1 -t 1 -i 'img-%04d.jpg'  \
-filter_complex "\
[1:v][0:v]blend=all_expr='A*(if(gte(T,0.7),1,T/0.7))+B*(1-(if(gte(T,0.7),1,T/0.7)))'[b1v]; \
[0:v][b1v][1:v]concat=n=3:v=1:a=0,format=yuv420p[v]" \
 -map "[v]" out.avi

As far as I understood the syntax, the file names should be okay for this scenario. The files under test are the same as the ones explicitly stated in the first command. But I cannot manage to get passed the following error:

Input #0, image2, from 'img-%04d.jpg':
Duration: 00:00:00.08, start: 0.000000, bitrate: N/A
Stream #0:0: Video: mjpeg, yuvj422p(pc, bt470bg/unknown/unknown), 2592x1728     [SAR 72:72 DAR 3:2], 25 fps, 25 tbr, 25 tbn, 25 tbc
Invalid file index 1 in filtergraph description [1:v][0:v]blend=all_expr='A* (if(gte(T,0.7),1,T/0.7))+B*(1-(if(gte(T,0.7),1,T/0.7)))'[b1v]; [0:v][b1v]   [1:v]concat=n=3:v=1:a=0,format=yuv420p[v].

It looks like I am using the file pattern syntax wrong. What am I missing? Thanks in advance.

Aucun commentaire:

Enregistrer un commentaire