Skip to content

Instantly share code, notes, and snippets.

@stevehanson
Last active September 24, 2025 18:42
Show Gist options
  • Select an option

  • Save stevehanson/35f8448848c2502595380359e8aeb6e4 to your computer and use it in GitHub Desktop.

Select an option

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
# the `>/dev/null 2>&1 &` bit moves conversion to the background so it doesn't freeze Finder
for f in "$@"
do
if [[ "$f" == *.mp4 ]]; then
/opt/homebrew/bin/ffmpeg -i "$f" -c:v libx264 -crf 25 "${f%.mp4}.compressed.mp4" >/dev/null 2>&1 &
else
/opt/homebrew/bin/ffmpeg -i "$f" -c:v libx264 -crf 24 "${f%.*}.mp4" >/dev/null 2>&1 &
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment