0

I'm using this to create a video from multiple sources. But, the output has only until frames/300100.PNG. What should I change to make it encode all my inputs?

ffmpeg -i body.mp3 
    -framerate 60 -loop 1 -t 16.368 -i frames/000000.PNG 
    -i 1.mp4 -framerate 60 -loop 1 -t 3.959 -i frames/100100.PNG 
    -i 2.mp4 -framerate 60 -loop 1 -t 6.574 -i frames/200100.PNG 
    -i 3.mp4 -framerate 60 -loop 1 -t 5.134 -i frames/300100.PNG 
    -i 4.mp4 -framerate 60 -loop 1 -t 4.559 -i frames/400100.PNG 
    -i 5.mp4 -framerate 60 -loop 1 -t 5.351 -i frames/500100.PNG 
    -i 6.mp4 -framerate 60 -loop 1 -t 4.390 -i frames/600100.PNG 
    -i 7.mp4 -framerate 60 -loop 1 -t 8.950 -i frames/700100.PNG 
-filter_complex "[1][2][3][4][5][6][7]concat=n=7:v=1:a=0[v]" 
-map "[v]" -map 0:a -pix_fmt yuv420p out.mp4

2 Answers 2

2

You have to feed all inputs to the concat filter, and set the correct number of inputs in n. FFmpeg input index starts from 0. So the fifth input has an index of 4 and would be fed as [4] in the concat filter.

ffmpeg -i body.mp3 
    -framerate 60 -loop 1 -t 16.368 -i frames/000000.PNG 
    -i 1.mp4
    -framerate 60 -loop 1 -t 3.959 -i frames/100100.PNG 
    -i 2.mp4
    -framerate 60 -loop 1 -t 6.574 -i frames/200100.PNG 
    -i 3.mp4
    -framerate 60 -loop 1 -t 5.134 -i frames/300100.PNG 
    -i 4.mp4
    -framerate 60 -loop 1 -t 4.559 -i frames/400100.PNG 
    -i 5.mp4
    -framerate 60 -loop 1 -t 5.351 -i frames/500100.PNG 
    -i 6.mp4
    -framerate 60 -loop 1 -t 4.390 -i frames/600100.PNG 
    -i 7.mp4
    -framerate 60 -loop 1 -t 8.950 -i frames/700100.PNG 
-filter_complex "[1][2][3][4][5][6][7][8][9][10][11][12][13][14][15]concat=n=15:v=1:a=0[v]" 
-map "[v]" -map 0:a -pix_fmt yuv420p out.mp4
3
  • You probably contradict yourself: [1][2][3][4][5][6][7][8][9][10][11][12][13][14][15] or [0][1][2][3][4][5][6][7][8][9][10][11][12][13][14]?
    – MarianD
    Aug 23, 2019 at 11:15
  • @MarianD the answer is correct. [0] is not to be fed to the concat filter. See OP's last Q.
    – Gyan
    Aug 23, 2019 at 12:37
  • Oh, you're right (as almost always). My inadvertence. :-(
    – MarianD
    Aug 23, 2019 at 13:39
1

This is not a new answer — this is only the summary of the Gyan's answer:

  • You have 16 inputs (16 times -i options) but you enumerated only 7 of them in [1][2][3][4][5][6][7] (and declared only 7 of them in concat=n=7...,, too):

    -filter_complex "[1][2][3][4][5][6][7]concat=n=7:v=1:a=0[v]" 
    

    So you effectively excluded the first input -i body.mp3 with index 0 (which you wanted, because you used it as a background music), but another 8 with indices 8 to 15, too (which you don't wanted).


The result is that the accepted inputs for the concat filter are only from your lines

-framerate 60 -loop 1 -t 16.368 -i frames/000000.PNG
-i 1.mp4 -framerate 60 -loop 1 -t 3.959 -i frames/100100.PNG 
-i 2.mp4 -framerate 60 -loop 1 -t 6.574 -i frames/200100.PNG 
-i 3.mp4 -framerate 60 -loop 1 -t 5.134 -i frames/300100.PNG 

(7 inputs; the first input -i body.mp3is omitted.)

It is in concordance with the statement in your question.

1
  • Thank you for the detailed explanation. Could you also explain what v=1:a=0[v] does? I'm trying to add one more .mp3 as an input. Edit: I'm not looking to overlay the audios. Aug 26, 2019 at 18:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.