diff options
author | Jonas Smedegaard <dr@jones.dk> | 2017-05-17 08:44:33 +0200 |
---|---|---|
committer | Jonas Smedegaard <dr@jones.dk> | 2017-05-17 08:44:33 +0200 |
commit | 363f4d522d8ef47dd30537371e7d7ebc53730a48 (patch) | |
tree | 4f2c5741f0e5ec0e798aead20555c423d732f38d /bin/stream | |
parent | 32f01bcedc57b2aef30bbbd37d02ffa77a219a41 (diff) |
Vary x264 speed based on height, and make not on doing same for vpx.
Diffstat (limited to 'bin/stream')
-rwxr-xr-x | bin/stream | 17 |
1 files changed, 10 insertions, 7 deletions
@@ -88,17 +88,20 @@ HEIGHT=270 HEIGHTS_WEBM="$HEIGHT" HEIGHTS_MPEG="$HEIGHT" +# TODO: Vary vpx quality based on height SPEED_VPX=15 -SPEED_X264=ultrafast # inspired by Apple HLS recommendations - if [ $HEIGHT -le 234 ]; then VBITRATE=145000; -elif [ $HEIGHT -le 270 ]; then VBITRATE=365000; -elif [ $HEIGHT -le 360 ]; then VBITRATE=730000; -elif [ $HEIGHT -le 432 ]; then VBITRATE=1100000; -elif [ $HEIGHT -le 540 ]; then VBITRATE=2000000; -elif [ $HEIGHT -le 720 ]; then VBITRATE=3000000; +# TODO: Externalize to site-specific configfile + if [ $HEIGHT -le 234 ]; then VBITRATE=145000; SPEED_X264=slow; SPEED_X264_ALONE=fast; +elif [ $HEIGHT -le 270 ]; then VBITRATE=365000; SPEED_X264=faster; SPEED_X264_ALONE=fast; +elif [ $HEIGHT -le 360 ]; then VBITRATE=730000; SPEED_X264=faster; SPEED_X264_ALONE=fast; +elif [ $HEIGHT -le 432 ]; then VBITRATE=1100000; SPEED_X264=veryfast; SPEED_X264_ALONE=fast; +elif [ $HEIGHT -le 540 ]; then VBITRATE=2000000; SPEED_X264=toofast; SPEED_X264_ALONE=veryfast; +elif [ $HEIGHT -le 720 ]; then VBITRATE=3000000; SPEED_X264=toofast; SPEED_X264_ALONE=ultrafast; fi +[ -n "$HEIGHTS_WEBM" ] || SPEED_X264="$SPEED_X264_ALONE" +[ toofast != "$SPEED_X264" ] || exit1 "Not enough CPU - reduce size or streams" # shellcheck disable=SC2048,SC2059 echo_n() { |