Skip to content

Instantly share code, notes, and snippets.

@zonca
Last active May 9, 2023 06:39
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save zonca/c13da23155e3451329746772187a2016 to your computer and use it in GitHub Desktop.
Save zonca/c13da23155e3451329746772187a2016 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

on macos find does not have printf, so list should be build with something like:

find . -type f -name '*.mp4' -print0 | xargs -I {} -0 stat -f "file '$PWD/{}'" | sort

So on macOS it can be like this:

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

Or just install another find

brew install findutils

and then create alias:

alias find=gfind

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