3

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?

1 Answer 1

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

  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?

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

  1. 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.

  1. 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

Your Answer

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

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