summaryrefslogtreecommitdiff
path: root/bin/stream
diff options
context:
space:
mode:
Diffstat (limited to 'bin/stream')
-rwxr-xr-xbin/stream17
1 files changed, 11 insertions, 6 deletions
diff --git a/bin/stream b/bin/stream
index 4b0137b..4b42db2 100755
--- a/bin/stream
+++ b/bin/stream
@@ -102,8 +102,6 @@ fi
[ -z "$XINPUT" ] || [ $XINPUT -eq 1 ] || exit1 "Too many arguments: Max. 1 multimedia source"
[ -n "${NOAUDIO:-}" ] || [ -z "$AINPUT$XINPUT" ] || HASAUDIO=1
[ -n "${NOVIDEO:-}" ] || [ -z "$VINPUT$XINPUT" ] || HASVIDEO=1
-TARGETS_WEBM="${HASAUDIO:+rtp_opus} ${HASVIDEO:+rtp_vp8}"
-TARGETS_MPEG="rtp_mpegts"
VSTREAMINDEX=1
[ -n "$AINPUT" ] || VSTREAMINDEX=0
@@ -142,7 +140,12 @@ BITS=$(videosize "$HEIGHT" "$RATIO")
# 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 [ -z "$BITS" ] || [ $BITS -eq 0 ]; then # 192x80 → 15360
+ AFRAMERATE_AAC=22050
+ ABITRATE_OPUS=16000
+ ABITRATE_AAC=32000
+ HASVIDEO=
+elif [ $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
@@ -183,10 +186,12 @@ elif [ $BITS -le 922560 ]; then # 4:3'816→16²*68*51=887808, 16:9'720→16²*
SPEED_X264=toofast; SPEED_X264_ALONE=ultrafast
SPEED_VP8_ALONE=15
fi
-[ toofast != "$SPEED_X264" ] || ENCODINGS_MPEG=
-[ -n "$ENCODINGS_MPEG" ] || SPEED_VP8="$SPEED_VP8_ALONE"
-[ -n "$ENCODINGS_WEBM" ] || SPEED_X264="$SPEED_X264_ALONE"
+[ toofast != "${SPEED_X264:-}" ] || ENCODINGS_MPEG=
+[ -n "$ENCODINGS_MPEG" ] || SPEED_VP8="${SPEED_VP8_ALONE:-}"
+[ -n "$ENCODINGS_WEBM" ] || SPEED_X264="${SPEED_X264_ALONE:-}"
+TARGETS_WEBM="${HASAUDIO:+rtp_opus} ${HASVIDEO:+rtp_vp8}"
+TARGETS_MPEG="rtp_mpegts"
ENCODINGS=$(uniqwords "$ENCODINGS_WEBM $ENCODINGS_MPEG")
[ -z "${SAVEDIR:-}" ] || SAVESTEM="${SAVEDIR:-}/$(date +%Y%m%d-%H%M%S)"