Created
January 19, 2026 21:49
-
-
Save riccardo1980/c3a249c7de2c1916925d7934085b5de0 to your computer and use it in GitHub Desktop.
Two pass encode ffmpeg
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
| #!/usr/bin/env bash | |
| set -e | |
| #BR=2100k #kbit/s | |
| #SCALE="1024:768" | |
| #OUTPUT="medium_quality.mp4" | |
| BR=800k #kbit/s | |
| SCALE="800:600" | |
| OUTPUT="low_quality.mp4" | |
| INPUT="PXL_20260116_142011708.mp4" | |
| ffmpeg -y -i $INPUT -c:v libx264 -b:v $BR -vf scale=$SCALE -pix_fmt yuv420p -map_metadata -1 -pass 1 -an -f mp4 /dev/null | |
| ffmpeg -i $INPUT -c:v libx264 -b:v $BR -vf scale=$SCALE -pix_fmt yuv420p -map_metadata -1 -pass 2 -an $OUTPUT |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment