6

So I have multiple videos of the same scenery from different angles. These are stored as separate files. Can I combine these as multiple video streams within one file?

For example I know this is possible with MKV, I just don't know how to "join" them.

Is this possible using ffmpeg? If so, which command sequence do I use? If not, what other application would be able to do this?

6

Yes, this is possible using ffmpeg and the mkv container.

An example command sequence would be:

ffmpeg -i input1 -i input2 -c copy -map 0 -map 1 output.mkv

source

Breaking down the command:

  • -i input1 This selects the first input file. Could be something like my video_track1.mov.
  • -i input2 Here you can specify the second input file. You can add another entry -i input3 if you have more input videos. I don't know what the maximum amount of videos is you can place in one mkv container.
  • -c copy This copies all the streams (audio and video) in their original encoding.
  • -map 0 This maps all the streams (audio and video) of the first input file to the first track of the output file.
  • -map 1 This maps all the streams (audio and video) of the second input file to the second track of the output file.

More information on the -map option can be found in the documentation of ffmpeg.

  • Thank you Bart. Just a quick follow-up question if I may. Suppose the 2nd video is a bit shorter than the 1st video I want to combine, is there any way I can offset at which point the second stream should be available (eg. 1 second later), to keep the two streams in sync? – Zuiq Pazu Oct 21 '14 at 7:22
  • Not sure, I'm not an expert, just a happy Googler, but you could experiment with the -ss option. Please edit your question with the addition and add an answer yourself including the ffmpeg code if you find that it works. This will help future visitors. – Saaru Lindestøkke Oct 21 '14 at 7:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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