You cannot do this in a single command. However, assuming you run on Linux and have Bash (or similar ones) as your shell, all it takes is two commands. Please note that this only works if the videos all have the exact same video and audio codecs and time base (fps, etc.).
1. Create a list of videos and start times
You first have to make an edit list containing the following. Let's call it
Note that this does not support video names with spaces.
2. Split the videos
Now we'll create a temporary folder to hold our smaller videos. Let's call it
tmp. Then you can split up your files like so:
while read video time; do ffmpeg -i $video -ss $time -t 10 -c copy tmp/$video; done < videos
-t 10 means we'll cut 10 seconds from the video, starting at the timestamp defined by
-ss. You can also use
-to instead of
-t to have it cut until a particular point.
If your input videos all have different video and audio codecs, you need to re-encode the videos at this point. For this you should replace the
-c copy part with the specific video and audio codec settings, e.g.
-c:v libx264 -c:a libfaac for H.264 / AAC video and audio.
3. Concatenate the videos
Now, using the
concat protocol we can merge the files back together:
ffmpeg -f concat -i <(for f in tmp/*.webm; do echo "file '$f'"; done) -c copy output.webm
This is all you need. It works by dynamically creating a concatenation file on the fly. Otherwise you'd have to create it manually according to the
Finally you can clean up your