Showing posts with label ffmpeg. Show all posts
Showing posts with label ffmpeg. Show all posts

Thursday, 26 December 2024

Concatenating video files

For video files that come in part, use ffmpeg to merge them into 1 file

Eg: part1.mp4, part2.mp4, part3.mp4

Create a concat file - list.txt

file 'part1.mp4'
file 'part2.mp4'
file 'part3.mp4'

Use ffmpeg to merge into full.mp4

ffmpeg -f contact -safe 0 -i list.txt -c copy full.mp4

If you have subtitles create an additional concat file - subts.txt

file 'part1.mp4.srt'
file 'part2.mp4.srt'
file 'part3.mp4.srt'

Then use ffmpeg to create the full file

ffmpeg -f concat -safe 0 -i list.txt -f concat -safe 0 -i subs.txt -map 0 -map 1 -c copy -metadata:s:s language=eng -metadata:s:s title=English full.mp4

The title= seems to be necessary when doing subtitles and it names the subtitle track.