howto:merge-video
This is an old revision of the document!
Merge/Combine/Join Video
MPG/MPEG files:
sudo apt-get install mpgtx mpgjoin vid1.mpg vid2.mpg vid3.mpg -o combinedvideo.mpg
WMV files (same codec/properties):
ls -la > list.txt #edit list and sort/format lines as # file 'video1.wmv' # file 'video2.wmv' # file 'video3.wmv' #or ls -1 *.wmv | sort -n | sed "s/\(.*\)/file '\1'/" > list.txt ffmpeg -f concat -safe 0 -i list.txt -c copy outputfilename.wmv #or ffmpeg -f concat -safe 0 -i video1.wmv video2.wmv video3.wmv -c copy outputfilename.wmv
Script for multiple conversions based on filename pattern. Converts all related files that have a number at the end and start with 1:
#!/bin/bash SAVEIFS=$IFS IFS=$(echo -en "\n\b") for f in *1.wmv do shortfile=${f::-5} echo "file '"$shortfile"1.wmv" > list.txt echo "file '"$shortfile"2.wmv" >> list.txt echo "file '"$shortfile"3.wmv" >> list.txt ffmpeg -f concat -safe 0 -i list.txt -c copy $shortfile.wmv rm list.txt done IFS=$SAVEIFS
howto/merge-video.1662290247.txt.gz · Last modified: 2023/05/29 11:53 (external edit)