<p>You can do this with <code>ffmpeg</code> using either the <a href="https://ffmpeg.org/ffmpeg-filters.html#concat" rel="nofollow">concat filter</a> or the <a href="https://ffmpeg.org/ffmpeg-formats.html#concat" rel="nofollow">concat demuxer</a>. Which one to use depends whether or not your inputs have the same parameters or not. If they do not, you may have to perform additional filtering to make everything suitable to be concatenated properly.</p>

<h1>Example: concat filter</h1>

<p>For inputs that vary in frame rate, width, and height:</p>

<pre><code>ffmpeg -i video0 -i video1 -i video2 -i music -filter_complex \
"[0:v]fps=25,scale=1280x720,setpts=PTS-STARTPTS[v0]; \
"[1:v]fps=25,scale=1280x720,setpts=PTS-STARTPTS[v1]; \
"[2:v]fps=25,scale=1280x720,setpts=PTS-STARTPTS[v2]; \
"[v0][v1][v2]concat=n=3:v=1:a=0,format=yuv420p[v]" \
-map "[v]" -map 3:a -shortest output
</code></pre>

<p>If outputting mp4 consider adding <code>-movflags +faststart</code> as an output option if your viewers will watch via progressive download.</p>

<h1>Example: concat demuxer</h1>

<p>If all of your inputs are similar then first make a list file named <code>input.txt</code>:</p>

<pre><code>file "/path/to/video0"
file "/path/to/video1"
file "/path/to/video2"
</code></pre>

<p>Then run <code>ffmpeg</code>:</p>

<pre><code>ffmpeg -f concat -i input.txt -i music -shortest output
</code></pre>

<p>Add <code>-codec copy</code> if you want to <a href="https://ffmpeg.org/ffmpeg.html#Stream-copy" rel="nofollow">stream copy</a> instead of re-encode. This is not possible with the concat filter because filtering requires re-encoding.</p>

<h2>Your questions</h2>

<blockquote>
  <ol>
  <li>Is it possible to map a web form to the assets listed above (located on a local server) and have the web form ultimately build the order of the video and render out to the local server?</li>
  </ol>
</blockquote>

<p>Yes. As long as your <a href="https://ffmpeg.org/ffmpeg-protocols.html" rel="nofollow">protocol</a> is supported by <code>ffmpeg</code>. See <code>ffmpeg -protocols</code> for a list supported by your build.</p>

<blockquote>
  <ol start="2">
  <li>If possible, would FFmpeg or Animoto API (or another) be the right choice?</li>
  </ol>
</blockquote>

<p>It is possible with <code>ffmpeg</code>, but I've never used Animoto API so I can't comment on that.</p>

<blockquote>
  <ol start="3">
  <li>What kind of time/resources would it take to build something like this?</li>
  </ol>
</blockquote>

<p>That's not really possible to answer. You provided very little info and it depends on the skill of whoever is building it.</p>

<h2>Also see</h2>

<ul>
<li><a href="http://trac.ffmpeg.org/wiki/Concatenate" rel="nofollow">FFmpeg Wiki: Concatenate</a></li>
</ul>

CC BY-SA 3.0
2016-02-06T18:09:46.483Z
2016-02-06T18:38:26.510Z
2016-02-06T18:38:26.510Z
llogan
<p>Need some help automating video &amp; audio stitching and could use some help/direction.</p>

<p>Let's say I have the following assets:
Video 1
Video 2
Video 3
Music 1</p>

<p>And I want to build a few variations of the above assets like:</p>

<p><b>Variation #1</b><br>
Video 1 -> Video 3<br>
&lt;----Music 1-----><br></p>

<p><b>Variation #2</b><br>
Video 3 -> Video 1<br>
&lt;----Music 1-----><br></p>

<p><b>Note</b> Music would need to be trimmed based on the length of the videos combined.</p>

<ol>
<li><p>Is it possible to map a web form to the assets listed above (located on a local server) and have the web form ultimately build the order of the video and render out to the local server?</p></li>
<li><p>If possible, would FFmpeg or Animoto API (or another) be the right choice?</p></li>
<li><p>What kind of time/resources would it take to build something like this?</p></li>
</ol>

<video><after-effects><ffmpeg><video-editor><automation>
Is ffmpeg the solution to automate video building from multiple files
TruTru
# Is ffmpeg the solution to automate video building from multiple files

(Asked by: username_0 on 2016-02-06)

Need some help automating video & audio stitching and could use some help/direction.

Let's say I have the following assets:
Video 1
Video 2
Video 3
Music 1

And I want to build a few variations of the above assets like:

**Variation #1**  
Video 1 -> Video 3  
<----Music 1----->

**Variation #2**  
Video 3 -> Video 1  
<----Music 1----->

**Note** Music would need to be trimmed based on the length of the videos combined.

1. Is it possible to map a web form to the assets listed above (located on a local server) and have the web form ultimately build the order of the video and render out to the local server?
2. If possible, would FFmpeg or Animoto API (or another) be the right choice?
3. What kind of time/resources would it take to build something like this?

**Tags:** video, after-effects, ffmpeg, video-editor, automation


---

## 1 answers

### Answer by username_1 on 2016-02-06. Score: 4

You can do this with ffmpeg using either the concat filter or the concat demuxer. Which one to use depends whether or not your inputs have the same parameters or not. If they do not, you may have to perform additional filtering to make everything suitable to be concatenated properly.
Example: concat filter
For inputs that vary in frame rate, width, and height:
ffmpeg -i video0 -i video1 -i video2 -i music -filter_complex \
"[0:v]fps=25,scale=1280x720,setpts=PTS-STARTPTS[v0]; \
"[1:v]fps=25,scale=1280x720,setpts=PTS-STARTPTS[v1]; \
"[2:v]fps=25,scale=1280x720,setpts=PTS-STARTPTS[v2]; \
"[v0][v1][v2]concat=n=3:v=1:a=0,format=yuv420p[v]" \
-map "[v]" -map 3:a -shortest output

If outputting mp4 consider adding -movflags +faststart as an output option if your viewers will watch via progressive download.
Example: concat demuxer
If all of your inputs are similar then first make a list file named input.txt:
file "/path/to/video0"
file "/path/to/video1"
file "/path/to/video2"

Then run ffmpeg:
ffmpeg -f concat -i input.txt -i music -shortest output

Add -codec copy if you want to stream copy instead of re-encode. This is not possible with the concat filter because filtering requires re-encoding.
Your questions


Is it possible to map a web form to the assets listed above (located on a local server) and have the web form ultimately build the order of the video and render out to the local server?


Yes. As long as your protocol is supported by ffmpeg. See ffmpeg -protocols for a list supported by your build.


If possible, would FFmpeg or Animoto API (or another) be the right choice?


It is possible with ffmpeg, but I've never used Animoto API so I can't comment on that.


What kind of time/resources would it take to build something like this?


That's not really possible to answer. You provided very little info and it depends on the skill of whoever is building it.
Also see

FFmpeg Wiki: Concatenate


---

