
Unfortunately in my initial testing with YouTube, neither format maintains the second stream of subtitles. When playing the ConcatenatedVideo files on my local machine, I can now enable or disable the closed caption track properly in the player for either format. ffmpeg -f concat -safe 0 -i mp4files.txt -f concat -safe 0 -i srtfiles.txt -map 0:v -map 1 -c:v copy -c:s copy ConcatenatedVideo.MKV

The FFMPEG command to create an MKV command is only a tiny bit different, and the resulting file is only a tiny bit smaller. ffmpeg -f concat -safe 0 -i mp4files.txt -f concat -safe 0 -i srtfiles.txt -map 0:v -map 1 -c:v copy -c:s mov_text ConcatenatedVideo.MP4 My FFMPEG command to create an MP4 file gets a lot more involved because now I’m specifying multiple inputs and have to specify the subtitle format. In this case I’m using srtfiles.txt file DJI00001.SRT If you want to embed the subtitles, you need to create a second text file, do some stream mapping, and specify what format the subtitles should be. ffmpeg -f concat -safe 0 -i mp4files.txt -c copy ConcatenatedVideo.MP4 Then use the ffmpeg command to create a new concatenated file. To simply concatenate the video files, create a text input file (I’m using mp4files.txt) with the contents as follows file DJI00001.MP4

The method I’m using should work for any number of files, up to the largest filesize you can store on your filesystem. I’ll give several examples using the two video files and their associated subtitle files created by the drone named DJI00001.MP4, DJI00002.MP4, DJI00001.SRT, and DJI00002.SRT. If you are interested in video container formats, these tables are very helpful. The MP4 ( MPEG-4 Part 14) container format only supports a limited selection of subtitle formats, so I’m required to have FFMPEG convert the SRT stream to a MP4 compatible stream. The MKV ( Matroska Multimedia Container) container format can hold almost any type of media, and so I’m able to copy the SRT format directly.

The MP4 format is more widely supported than the MKV format, but is less flexible as to what it can contain. Today I learned how to properly embed the subtitles in either the MKV or MP4 container format. Concatenating the video with FFMPEG has been something I’ve known how to do for a long time using either of two methods.
