Last active
September 24, 2025 18:42
-
-
Save stevehanson/35f8448848c2502595380359e8aeb6e4 to your computer and use it in GitHub Desktop.
Compress Video (Automator script)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 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