Skip to content

Instantly share code, notes, and snippets.

@stevehanson
Created June 11, 2025 22:22
Show Gist options
  • Save stevehanson/35f8448848c2502595380359e8aeb6e4 to your computer and use it in GitHub Desktop.
Save stevehanson/35f8448848c2502595380359e8aeb6e4 to your computer and use it in GitHub Desktop.
Compress Video (Automator script)
# in automator, "Get Selected Finder Items" -> receive "Current movie files", then "Run shell script" with below script
# If is already an mp4, adds "compressed" on the end (so doesn't overwrite) and compresses a bit more heavily
# otherwise converts video like .mov to .mp4
for f in "$@"
do
if [[ "$f" == *.mp4 ]]; then
/opt/homebrew/bin/ffmpeg -i "$f" -c:v libx264 -crf 25 "${f%.mp4}.compressed.mp4"
else
/opt/homebrew/bin/ffmpeg -i "$f" -c:v libx264 -crf 24 "${f%.*}.mp4"
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment