Skip to content

Instantly share code, notes, and snippets.

@jhallard
Created June 22, 2018 19:10
Show Gist options
  • Save jhallard/7094e593218cef7213b5ebdf15ae8d0f to your computer and use it in GitHub Desktop.
Save jhallard/7094e593218cef7213b5ebdf15ae8d0f to your computer and use it in GitHub Desktop.
Bash function to concatenate all mp4 video file into a single mp4 file at /tmp/concat
function vidconcat {
TEMP=$(mktemp /tmp/temporary-file.XXXXXXXX)
for file in "$@"
do
echo "file '$file'" >> $TEMP
done
ffmpeg -loglevel error -hide_banner -f concat -safe 0 -i $TEMP -c copy /tmp/concat.mp4
echo "concat video file is at /tmp/concat.mp4"
rm -f $TEMP
}
### use like ###
# $ viconcat video1.mp4 video2.mp4 video3.mp4
# concat video file is at /tmp/concat.mp4
# $ ls -l /tmp/concat.mp4
# -rw-r--r-- 1 john wheel 11342633 Jun 22 12:09 /tmp/concat.mp4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment