Show pageOld revisionsBacklinksExport to PDFBack to top This page is read only. You can view the source, but not change it. Ask your administrator if you think this is wrong. ===== Merge/concatenate multiple video/audio files into one ===== This is useful when you need to combine multiple videos into one, either from parts above, or more likely, to make a pseudo-playlist or slideshow of videos. This method also works for audio files such as if you're going to burn a continous track on a CD, or combine interviews for a podcast or whatever. First, get the list of files in a text file. It needs to be in the format of "file filename" in each line. <code> find *.mkv | sed 's:\ :\\\ :g'| sed 's/^/file /'> files </code> Here is a command that will make a text file called files of all mkv files in a folder. You can do this for any extension, and the sed command will append the file structure needed. Next, run ffmpeg to merge the video or audio segments. <code> ffmpeg -f concat -safe 0 -i files -c copy output.mkv </code> This will take in all the files in the list generated above, copy the codecs without re-encoding into the output. You may or may not want to re-encode when merging. If your inputs have different codecs, re-encode the input. If you're merging from parts you generated by splitting the video manually (see above example), then you can just copy the codecs. scripts/ffmpeg/merge_concatenate_video_audio_files.txt Last modified: 2022-04-06 21:52by Tony