I have two videos of the same format encoded with the same codecs. I want trailer.mkv to be played after n
minutes in the middle of main.mkv. After playing trailer.mkv, the rest of the main.mkv will continue playing. How can I concatenate them?
1 Answer
I know how to do it in three steps. Separate your main video.
Step 1. Trim the end.
ffmpeg -i main.mkv -c copy -t 00:02:00 main-intro.mkv
Step 2. Trim the start.
ffmpeg -i main.mkv -c copy -ss 00:02:00 main-outro.mkv
Step 3. Concatenate them with your trailer file.
ffmpeg -safe 0 -i "concat:main-intro.mkv|trailer.mkv|main-outro.mkv" -c copy output.mkv
You can write script and you will have opportunity to do it in one click.