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

<pre><code>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
</code></pre>

CC BY-SA 4.0
2019-08-23T11:15:10.273Z
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
CC BY-SA 4.0
2019-08-23T12:37:01.180Z
@MarianD the answer is correct. [0] is not to be fed to the concat filter. See OP's last Q.
Gyan
CC BY-SA 4.0
2019-08-23T13:39:31.420Z
Oh, you're right (as almost always). My inadvertence. :-(
MarianD
CC BY-SA 4.0
2019-08-22T14:12:38.743Z
2019-08-22T14:12:38.743Z
Gyan
<p>This is <em>not a new answer</em> — this is only the <em>summary of the Gyan's answer:</em></p>

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

<blockquote>
<pre><code>-filter_complex "[1][2][3][4][5][6][7]concat=n=7:v=1:a=0[v]" 
</code></pre>
</blockquote>

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

<hr>

<p>The result is that the accepted inputs for the <code>concat</code> filter are only from your lines</p>

<pre><code>-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 
</code></pre>

<p>(7 inputs; the first input <code>-i body.mp3</code>is omitted.)</p>

<p>It is in concordance with the statement in your question. </p>

CC BY-SA 4.0
2019-08-26T18:20:54.103Z
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.
Testaccount
CC BY-SA 4.0
2019-08-23T11:27:18.523Z
2019-08-23T13:35:25.647Z
2019-08-23T13:35:25.647Z
MarianD
<p>I'm using this to create a video from multiple sources. But, the output has only until <code>frames/300100.PNG</code>. What should I change to make it encode all my inputs?</p>

<pre><code>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
</code></pre>

<ffmpeg>
ffmpeg script encoding only few inputs
Testaccount
# ffmpeg script encoding only few inputs

(Asked by: username_0 on 2019-08-22)

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

**Tags:** ffmpeg


---

## 2 answers

### Answer by username_1 on 2019-08-22. Score: 2 | Accepted answer

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

> **Comments:**
> **username_2**: 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]`?  
> **username_1**: @username_2 the answer is correct. [0] is not to be fed to the concat filter. See OP's last Q.  
> **username_2**: Oh, you're right (as almost always). My inadvertence. :-(  

---

### Answer by username_2 on 2019-08-23. Score: 1

This is not a new answer — this is only the summary of the username_1'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.

> **Comments:**
> **username_0**: 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.  

---

