Skip to content

Instantly share code, notes, and snippets.

@ivan-leschinsky
Forked from zonca/concat_mp4.sh
Created May 9, 2023 06:39
Show Gist options
  • Save ivan-leschinsky/fd4d5957f1a711df3b406ec610dba548 to your computer and use it in GitHub Desktop.
Save ivan-leschinsky/fd4d5957f1a711df3b406ec610dba548 to your computer and use it in GitHub Desktop.
FFMPEG scripts to speedup and concatenate videos, useful for prerecording videos for conferences
ffmpeg -safe 0 -f concat -i <(find . -type f -name '*.mp4' -printf "file '$PWD/%p'\n" | sort) -c copy output.mp4
ffmpeg -i $1 -filter_complex "[0:v]setpts=0.87*PTS[v];[0:a]atempo=1.15[a]" -map "[v]" -map "[a]" speedup_$1
# ffmpeg_trim.sh input.mp4 00:14 03:24
ffmpeg -i $1 -ss 00:${2} -to 00:${3} -c:v copy -c:a copy ${1}_trim.mp4
@ivan-leschinsky
Copy link
Author

Prepare files:(rename them by creation date):

for f in *.MP4; do D=$(date -r $(stat -f %B "$f") +%Y-%m-%d-%H-%M-%S); cp "$f" "$D-$f"; done

@ivan-leschinsky
Copy link
Author

with simple encoding:

ffmpeg -safe 0 -f concat -i <(find . -type f -name '*.MP4' -print0 | xargs -I {} -0 stat -f "file '$PWD/{}'" | sort) -c:a copy -c:v h264  _output.mp4

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