Skip to content

Instantly share code, notes, and snippets.

@kndt84
Last active October 17, 2019 07:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kndt84/338df7995ed53d0653b2edd1368326d4 to your computer and use it in GitHub Desktop.
Save kndt84/338df7995ed53d0653b2edd1368326d4 to your computer and use it in GitHub Desktop.
Concat movie files with ffmpeg
#!/bin/bash
EXT=$1
OUTFILENAME=$2
TXTFILE=filelist.txt
ls -d ./*.${EXT} | sed 's/^/file /' > $TXTFILE
ffmpeg -f concat -safe 0 -i $TXTFILE -c copy ../$2 > /dev/null 2>&1 </dev/null
@kndt84
Copy link
Author

kndt84 commented Oct 29, 2018

$ ls
video0_2018-10-22_13:59:08+0900.mp4
video0_2018-10-22_14:01:08+0900.mp4
video0_2018-10-22_14:03:08+0900.mp4
video0_2018-10-22_14:05:08+0900.mp4
video0_2018-10-22_14:07:07+0900.mp4

$ concat.sh video0_2018-10-22 # Set prefix as argument value
$ ls .. # Concatenated file is created in parent directory
video0_2018-10-22.mp4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment