Skip to main content
  1. Posts/

Combine Lots of Video Clips Into One Very Quickly

·210 words·1 min

Say you have 30 (or any large number) different clips in a folder that you just want to combine (concatenate) based on the timestamps. You do not want to reencode them, just want to connect/combine them into one as if they were text files. The reason you do not want to re-encode them is that it’ll take a long time to process them and you might lose fidelity of the video if re-encode was not done correctly. The following instructions will just concatenate the files and produce a single file as an output in no time even on old hardware. (Ran this in FreeBSD 14.3 but you should be able to adapt it to a linux box or a Mac with homebrew).

Get a list of files in the order you want:
#

  • ls -1tr > files.txt. This saves the files we need in the order we need. You can edit this file using your editor if needed.

Create the concatenation list
#

  • Run this in /bin/sh: for f in $(ls -1tr); do echo "file '$f'" >> concat.txt; done

Run ffmpeg to assemble into a single file
#

  • ffmpeg -f concat -i concat.txt -c copy final-single.mp4

Final check
#

  • Now run it and upload it to your Immich server!

💝

Sanjay Regmi
Author
Sanjay Regmi