-
-
Save AlexRogalskiy/b7bdc5ca02101aa33072f2c1218a289b to your computer and use it in GitHub Desktop.
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
# ./ffmpeg_vp9_2pass.sh input.mp4 2M 96k 1920 60 | |
set -x | |
input="$1" | |
bitrate="${2:-2M}" | |
audio_bitrate="${3:-96k}" | |
scale="'min(${4:-1920},iw)':'ih*$4/iw'" | |
fps="${5:-60}" | |
output="${input%.*}_vp9_2pass.webm" | |
threads=48 | |
ffmpeg -i "$input" -c:v libvpx-vp9 -filter:v "scale=$scale" -pass 1 -b:v $bitrate -r $fps -threads "$threads" \ | |
-frame-parallel 0 -slices 8 -quality good -speed 1 -aq-mode 0 \ | |
-lag-in-frames 25 -auto-alt-ref 1 -sn -c:a libopus -b:a $audio_bitrate -ac 2 -y \ | |
-an -f webm /dev/null < /dev/null | |
ffmpeg -i "$input" -c:v libvpx-vp9 -filter:v "scale=$scale" -pass 2 -b:v $bitrate -r $fps -threads "$threads" \ | |
-frame-parallel 0 -slices 8 -quality good -speed 1 -aq-mode 0 \ | |
-lag-in-frames 25 -auto-alt-ref 1 -sn -c:a libopus -b:a $audio_bitrate -ac 2 -y \ | |
-f webm "$output" < /dev/null |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment