diff options
author | Jonas Smedegaard <dr@jones.dk> | 2017-06-08 15:44:29 +0200 |
---|---|---|
committer | Jonas Smedegaard <dr@jones.dk> | 2017-06-08 15:44:29 +0200 |
commit | 39ca4ccf4b1c15de75030b0a73db4d979b1ef347 (patch) | |
tree | 948c2b8662b7e29fdf54ae94039cfd07ed88ba64 /bin/stream | |
parent | c768bf3811a8d4183310d724164b0183ca5d1037 (diff) |
Support zero-videobitrate (i.e. audio-only).
Diffstat (limited to 'bin/stream')
-rwxr-xr-x | bin/stream | 17 |
1 files changed, 11 insertions, 6 deletions
@@ -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)" |