summaryrefslogtreecommitdiff
path: root/bin/stream
diff options
context:
space:
mode:
Diffstat (limited to 'bin/stream')
-rwxr-xr-xbin/stream30
1 files changed, 15 insertions, 15 deletions
diff --git a/bin/stream b/bin/stream
index 6a1e31b..4b0137b 100755
--- a/bin/stream
+++ b/bin/stream
@@ -132,17 +132,17 @@ videosize() { height=$1; width_or_ratio=$2;
BITS=$(videosize "$HEIGHT" "$RATIO")
# * bitrates and bits in parens based on https://developer.apple.com/library/content/documentation/General/Reference/HLSAuthoringSpec/Requirements.html
-# + bits rounded up to include nearby modulo 16 formats
-# * Recommended sizes (highest modulo 16 or 8 (or 4) size not "pumping"
-# in bridge scene 20s into Tears of Steel):
-# + 4:3: (96 216) 288 312 384 480 624 816
-# + 16:9: (72 160) 216 288 360 432 576 720
-# + 2.40:1: (80 160) 200 240 320 360 480 600
-# resolved using http://aarmstrong.org/content/aspect_ratio_calc.php
+# + bits rounded up to include nearby modulo 16 or 8 sizes
+# * Recommended modulo 16 or 8 (or 4) sizes:
+# + 4:3: [96 216] 264 312 408 480 624 816
+# + 16:9: [72 160] 216 288 360 432 496(540) 720
+# + 2.40:1: [80 160] 200 240 320 360 480 600(620)
+# (highest size not "pumping" in bridge scene 20s into Tears of Steel)
+# quantified using http://aarmstrong.org/content/aspect_ratio_calc.php
# with ratio as modulo 4 integers, and size a multiplum of that
# * speeds tuned to just below 100% cpu usage for each combination on a multi-core computer
# TODO: Externalize speeds to site-specific configfile
-if [ $BITS -le 15360 ]; then # 4:3'96→16²*8*6=12288, 16:9'72→8²*16*9=9216, 2.40:1'80→16*12*5=15360
+if [ $BITS -le 15360 ]; then # 4:3'96→16²*8*6=12288, 16:9'72→8²*16*9=9216, 2.40:1'80→16²*12*5=15360
AFRAMERATE_AAC=22050
ABITRATE_OPUS=16000
ABITRATE_AAC=32000
@@ -150,7 +150,7 @@ if [ $BITS -le 15360 ]; then # 4:3'96→16²*8*6=12288, 16:9'72→8²*16*9=9216,
VBITRATE=32000
SPEED_X264=fast; SPEED_X264_ALONE=fast
SPEED_VP8=3; SPEED_VP8_ALONE=2
-elif [ $BITS -le 62208 ]; then # 4:3'216→8²*27*36=62208, 16:9'160→16²*24*10=61440
+elif [ $BITS -le 62208 ]; then # 4:3'216→8²*27*36=62208, 16:9'160→16²*24*10=61440, 2.40:1'160→16²*24*10=61440
AFRAMERATE_AAC=22050
ABITRATE_OPUS=16000
ABITRATE_AAC=32000
@@ -158,27 +158,27 @@ elif [ $BITS -le 62208 ]; then # 4:3'216→8²*27*36=62208, 16:9'160→16²*24*1
VBITRATE=64000
SPEED_X264=fast; SPEED_X264_ALONE=fast
SPEED_VP8=3; SPEED_VP8_ALONE=2
-elif [ $BITS -le 110592 ]; then # 234p → 97344
+elif [ $BITS -le 110592 ]; then # 4:3'264→8²*44*33=92928, 16:9'216→8²*48*27=82944, 2.40:1'200→8²*60*25=96000 (234p→97344)
VBITRATE=145000
SPEED_X264=fast; SPEED_X264_ALONE=fast
SPEED_VP8=3; SPEED_VP8_ALONE=2
-elif [ $BITS -le 150528 ]; then # 270p → 129600
+elif [ $BITS -le 150528 ]; then # 4:3'312→8²*52*39=129792, 16:9'288→16²*32*18=147456, 2.40:1'240→16²*36*15=138240 (270p→129600)
VBITRATE=365000
SPEED_X264=faster; SPEED_X264_ALONE=fast
SPEED_VP8=4; SPEED_VP8_ALONE=2
-elif [ $BITS -le 196608 ]; then # 360p → 172800
+elif [ $BITS -le 245760 ]; then # 4:3'408→8²*68*51=221952, 16:9'360→8²*80*45=230400, 2.40:1'320→16²*48*20=245760 (360p→230400)
VBITRATE=730000
SPEED_X264=veryfast; SPEED_X264_ALONE=fast
SPEED_VP8=5; SPEED_VP8_ALONE=3
-elif [ $BITS -le 331776 ]; then # 432p → 331776
+elif [ $BITS -le 331776 ]; then # 4:3'480→16²*40*30=307200, 16:9'432→16²*48*27=331776, 2.40:1'360→8²*108*45=311040 (432p→331776)
VBITRATE=1100000
SPEED_X264=ultrafast; SPEED_X264_ALONE=fast
SPEED_VP8=8; SPEED_VP8_ALONE=4
-elif [ $BITS -le 589824 ]; then # 540p → 518400
+elif [ $BITS -le 552960 ]; then # 4:3'624→16²*52*39=519168, 16:9'496→16²*56*31=444416(540→4²*240*135=518400), 2.40:1'480→16²*72*30=552960 (540p→518400)
VBITRATE=2000000
SPEED_X264=toofast; SPEED_X264_ALONE=veryfast
SPEED_VP8_ALONE=5
-elif [ $BITS -le 921600 ]; then # 720p → 921600
+elif [ $BITS -le 922560 ]; then # 4:3'816→16²*68*51=887808, 16:9'720→16²*80*45=921600, 2.40:1'600→8²*180*75=864000(620→4²*372*155=922560) (720p→921600)
VBITRATE=3000000
SPEED_X264=toofast; SPEED_X264_ALONE=ultrafast
SPEED_VP8_ALONE=15