If in doubt about which method to use, try the concat demuxer.
This method does not work for many formats, including MP4, due to the nature of these formats and the simplistic concatenation performed by this method. ffmpeg -i "concat:input1|input2" -codec copy output.mkv Therefore you need (2+2)3 backslashes to escape things in drawtext. Java String needs 2 backslashes to make one and java replaceAll regex needs to have 2 backslashes to make a single one in a string. Use this method with formats that support file-level concatenation The key is ffmpeg drawtext needs 3 backslashes to escape (',:) and single quotes need to also be wrapped in a second pair of single quotes. $ ffmpeg -f concat -safe 0 -i mylist.txt -c copy output.mp4įor Windows: (echo file 'first file.mp4' & echo file 'second file.mp4' )>list.txtįfmpeg -safe 0 -f concat -i list.txt -c copy output.mp4 Use this method when you want to avoid a re-encode and your format does not support file-level concatenation (most files used by general users do not support file-level concatenation). ffmpeg -i opening.mkv -i episode.mkv -i ending.mkv \
If you want to avoid the re-encode, you could re-encode just the inputs that don't match so they share the same codec and other parameters, then use the concat demuxer to avoid re-encoding everything. The key is ffmpeg drawtext needs 3 backslashes to escape ,:) and single quotes need to also be wrapped in a second pair of single quotes. Note that this method performs a re-encode of all inputs. Use this method if your inputs do not have the same parameters (width, height, etc), or are not the same formats/codecs, or if you want to perform any filtering.
FFmpeg has three concatenation methods: 1.