Last active
January 27, 2021 07:19
-
-
Save TJC/57f9a21a8100814527a897b748791163 to your computer and use it in GitHub Desktop.
Re-encode OSX screen recording mov files to a tenth of their size
This file contains 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
#!/bin/bash | |
# Requires ffmpeg - brew install ffmpeg | |
if [[ -z "$1" ]]; then | |
echo "Usage: $0 Screen\\ Recording\\ at\\ 2021-01-21.mov" | |
exit 1 | |
fi | |
basefilename=$(basename "$1" .mov) | |
outputname="$basefilename.mp4" | |
nice ffmpeg \ | |
-i "$1" \ | |
-tune animation \ | |
-c:v libx264 -preset medium -profile:v high -pix_fmt yuv420p -level 4.2 -crf 24 \ | |
-c:a aac -profile:a aac_main -ab 128k \ | |
"$outputname" |
This file contains 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
#!/bin/bash | |
# Runs ffmpeg in Docker, meaning you don't need to have installed ffmpeg natively | |
if [[ -z "$1" ]]; then | |
echo "Usage: $0 Screen\\ Recording\\ at\\ 2021-01-21.mov" | |
exit 1 | |
fi | |
SRC=$(readlink -f "$1") | |
basefilename=$(basename "$1" .mov) | |
outputname="$basefilename.mp4" | |
docker container run -u 1000 --rm -v "$PWD:/mnt" \ | |
-v "$SRC:/input.mov:ro" \ | |
alfg/ffmpeg ffmpeg \ | |
-i "/input.mov" \ | |
-tune animation \ | |
-c:v libx264 -preset medium -profile:v high -pix_fmt yuv420p -level 4.2 -crf 24 \ | |
-c:a aac -profile:a aac_main -ab 128k \ | |
"/mnt/$outputname" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment