Skip to content

Instantly share code, notes, and snippets.

@gotofritz
Last active June 26, 2019 13:58
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 gotofritz/d8d1f478b8ee755723a197ed39597e2e to your computer and use it in GitHub Desktop.
Save gotofritz/d8d1f478b8ee755723a197ed39597e2e to your computer and use it in GitHub Desktop.
Various ffmpeg commands
# ffmpeg snippets
# ffmpeg-slowdown.sh: slow down all files in a directory
# ffmpeg-to-mp3.sh: convert all video files in a directory to mp3
# handbrake-bulk.sh: convert all webm fils in a folder to mp4
# slow down all files in a directory
# slowing down to 75.7575..%
# so the PTS factor is 1/757575758 = 1.32
for file in /path/to/somewhere/*
do
ffmpeg -i "$file" -filter_complex "[0:v]setpts=1.32*PTS[v];[0:a]atempo=0.7575758[a]" -map "[v]" -map "[a]" "${file/GAMES/GAMES_SLOW}" -y
done
# convert all video files in a directory to mp3
# using lame
for file in /path/to/somewhere/*.{mp4,webm}; do -i "$file" -c:a libmp3lame "${file/somewhere/mp3}.mp3"; done
# using ffmpeg
for file in /path/to/somewhere/*.{mp4,webm}; do ffmpeg -i "$file" -c:a libmp3lame "${file/somewhere/mp3}.mp3"; done
# convert all webm fils in a folder to mp4
for file in /path/to/somewhere/**/*.webm
do
HandBrakeCLI -Z "Fast 1080p30" -i "$file" -o "${file%.webm}.mp4"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment