summaryrefslogtreecommitdiff
path: root/bin/stream
diff options
context:
space:
mode:
Diffstat (limited to 'bin/stream')
-rwxr-xr-xbin/stream17
1 files changed, 10 insertions, 7 deletions
diff --git a/bin/stream b/bin/stream
index 71b6713..ac5135f 100755
--- a/bin/stream
+++ b/bin/stream
@@ -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() {