summaryrefslogtreecommitdiff
path: root/bin/stream
diff options
context:
space:
mode:
Diffstat (limited to 'bin/stream')
-rwxr-xr-xbin/stream15
1 files changed, 12 insertions, 3 deletions
diff --git a/bin/stream b/bin/stream
index 4c684eb..8a9c4e3 100755
--- a/bin/stream
+++ b/bin/stream
@@ -81,9 +81,18 @@ AFRAMERATE=24000
ABITRATE=16000
# FIXME: support multiple heights
-HEIGHTS_WEBM=234
-HEIGHTS_MPEG=234
-VBITRATE=145000
+HEIGHT=234
+HEIGHTS_WEBM="$HEIGHT"
+HEIGHTS_MPEG="$HEIGHT"
+
+# 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;
+fi
# shellcheck disable=SC2048,SC2059
echo_n() {