Skip to content

Instantly share code, notes, and snippets.

@paivaric
Last active August 29, 2018 19:53
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 paivaric/85fd9b3b34bfc584a214bd1168cfd7d1 to your computer and use it in GitHub Desktop.
Save paivaric/85fd9b3b34bfc584a214bd1168cfd7d1 to your computer and use it in GitHub Desktop.
Compress Files in Batch with FFMPEG
# first install FFMPEG
brew install ffmpeg $(brew options ffmpeg | grep -vE '\s' | grep -- '--with-' | tr '\n' ' ')
# find and compress
find . -iname "*.mp4" | xargs -I {} ffmpeg -i {} -vcodec libx264 -crf 40 -acodec aac -threads 0 {}_compressed.mp4
# ignore already compressed
find . -type f \( -iname "*.mp4" ! -iname "*compressed*" \) | xargs -I {} ffmpeg -i {} -vcodec libx264 -crf 40 -acodec aac -threads 0 {}_compressed.mp4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment