user3643: I'm trying to make a single ffmpeg command that will take multiple inputs, seek specific times within them, then output to a single file.
For example, I have inputA.avi and inputB.avi and each is 1 hour long. I want a single output file that takes inputA.avi from 00:00:00 to 00:20:00 for the beginning and inputB.avi from 00:00:00 to 00:10:00 for the end. The end result should be a 30 minute video file that has the first 20 minutes of inputA then the first 10 minutes of inputB.
I currently can do the following three commands to get the job done:
ffmpeg -ss 00:00:00 -t 00:20:00 -i inputA.avi [rest of command] inputA-trim.avi
ffmpeg -ss 00:00:00 -t 00:10:00 -i inputB.avi [rest of command] inputB-trim.avi
ffmpeg -f concat -i inputList.txt [rest of command] final.mp4

where inputList.txt contains only
file inputA-trim.avi
file inputB-trim.avi

This works, but has unnecessary steps and creates intermediary files. I also have to create a batch file and txt file to get everything to run in succession. I'd like to be able to create a single ffmpeg command that can take multiple inputs with individual -ss and -t commands, then put them in a single output.

user1871: #1 Using concat filter i.e. without textfile
ffmpeg -ss 0 -t 20:00 -i inputA.avi -ss 0 -t 10:00 -i inputB.avi -filter_complex "[0:v][0:a][1:v][1:a]concat=n=2:v=1:a=1" out.mp4

--OR--
#2 Using concat demuxer i.e. with textfile
file inputA-trim.avi
inpoint 0
outpoint 20:00
file inputB-trim.avi
inpoint 0
outpoint 10:00

and then your final command
ffmpeg -f concat -i inputList.txt [rest of command] final.mp4


See https://trac.ffmpeg.org/wiki/Concatenate for details.

3643: <p>I'm trying to make a single ffmpeg command that will take multiple inputs, seek specific times within them, then output to a single file.</p>

<p>For example, I have <code>inputA.avi</code> and <code>inputB.avi</code> and each is 1 hour long. I want a single output file that takes <code>inputA.avi</code> from 00:00:00 to 00:20:00 for the beginning and <code>inputB.avi</code> from 00:00:00 to 00:10:00 for the end. The end result should be a 30 minute video file that has the first 20 minutes of <code>inputA</code> then the first 10 minutes of <code>inputB</code>.</p>

<p>I currently can do the following three commands to get the job done:</p>

<pre><code>ffmpeg -ss 00:00:00 -t 00:20:00 -i inputA.avi [rest of command] inputA-trim.avi
ffmpeg -ss 00:00:00 -t 00:10:00 -i inputB.avi [rest of command] inputB-trim.avi
ffmpeg -f concat -i inputList.txt [rest of command] final.mp4
</code></pre>

<p>where inputList.txt contains only</p>

<pre><code>file inputA-trim.avi
file inputB-trim.avi
</code></pre>

<p>This works, but has unnecessary steps and creates intermediary files. I also have to create a batch file and txt file to get everything to run in succession. I'd like to be able to create a single ffmpeg command that can take multiple inputs with individual <code>-ss</code> and <code>-t</code> commands, then put them in a single output.</p>
 1871: <p><strong>#1</strong> Using concat filter i.e. without textfile</p>

<pre><code>ffmpeg -ss 0 -t 20:00 -i inputA.avi -ss 0 -t 10:00 -i inputB.avi -filter_complex "[0:v][0:a][1:v][1:a]concat=n=2:v=1:a=1" out.mp4
</code></pre>

<p>--OR--</p>

<p><strong>#2</strong> Using concat demuxer i.e. with textfile</p>

<pre><code>file inputA-trim.avi
inpoint 0
outpoint 20:00
file inputB-trim.avi
inpoint 0
outpoint 10:00
</code></pre>

<p>and then your final command</p>

<pre><code>ffmpeg -f concat -i inputList.txt [rest of command] final.mp4
</code></pre>

<hr>

<p>See <a href="https://trac.ffmpeg.org/wiki/Concatenate" rel="nofollow noreferrer">https://trac.ffmpeg.org/wiki/Concatenate</a> for details.</p>
