Last active
April 30, 2018 15:52
-
-
Save CrashLaker/2a38b6f5e7d1fff215b97f4a6c1410d0 to your computer and use it in GitHub Desktop.
Merge mp4 video files using bash + ffmpeg
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# $1 = filename | |
rm -f ${1}.mp4 | |
a=1;for file in `ls ${1}*.mp4`; do ffmpeg -i $file -c copy -bsf:v h264_mp4toannexb -f mpegts tmpfile${a}.ts; a=$((a+1)); done | |
ffmpeg -i "concat:`ls tmpfile*.ts | paste -s -d\"|\"`" -c copy -bsf:a aac_adtstoasc ${1}.mp4 | |
rm -f tmpfile*.ts | |
rm -f ${1}?.mp4 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment