From 88429972781b35be7e80ce4184e95cfca26d9a32 Mon Sep 17 00:00:00 2001 From: Jonas Smedegaard Date: Mon, 22 May 2017 10:46:13 +0200 Subject: Rename variables HEIGHT* → ENCODINGS*. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bin/stream | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/bin/stream b/bin/stream index 791df36..aaaa523 100755 --- a/bin/stream +++ b/bin/stream @@ -117,8 +117,8 @@ ABITRATE_AAC=64000 # FIXME: support multiple heights HEIGHT=288 -HEIGHTS_WEBM="$HEIGHT" -HEIGHTS_MPEG="$HEIGHT" +ENCODINGS_WEBM="$HEIGHT" +ENCODINGS_MPEG="$HEIGHT" videosize() { height=$1; width_or_ratio=$2; case $width_or_ratio in @@ -182,11 +182,11 @@ elif [ $BITS -le 921600 ]; then # 720p → 921600 SPEED_X264=toofast; SPEED_X264_ALONE=ultrafast SPEED_VP8_ALONE=15 fi -[ toofast != "$SPEED_X264" ] || HEIGHTS_MPEG= -[ -n "$HEIGHTS_MPEG" ] || SPEED_VP8="$SPEED_VP8_ALONE" -[ -n "$HEIGHTS_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" -HEIGHTS=$(uniqwords "$HEIGHTS_WEBM $HEIGHTS_MPEG") +ENCODINGS=$(uniqwords "$ENCODINGS_WEBM $ENCODINGS_MPEG") [ -z "${SAVEDIR:-}" ] || SAVESTEM="${SAVEDIR:-}/$(date +%Y%m%d-%H%M%S)" [ -z "${SAVEDIR:-}" ] || export FFREPORT=file="$SAVESTEM.log" @@ -194,11 +194,11 @@ HEIGHTS=$(uniqwords "$HEIGHTS_WEBM $HEIGHTS_MPEG") # * scale+watermark trick based on http://stackoverflow.com/a/10937357 # + scale to square pixels as needed filters_compose() { logo=$1; - heightcount=$(echo "$HEIGHTS" | wc --words) + heightcount=$(echo "$ENCODINGS" | wc --words) echo_n "[$VSTREAMINDEX:v]${DEINT:+$DEINT,}${VFRAMERATE:+framerate=$VFRAMERATE,}format=pix_fmts=yuv420p,split=$heightcount" - printf_each '[s%s]' "$HEIGHTS" + printf_each '[s%s]' "$ENCODINGS" echo_n ';' - for height in $HEIGHTS; do + for height in $ENCODINGS; do echo_n "[s$height]scale=trunc(iw*sar*$height/ih/2)*2:$height,setsar=1" [ -z "$logo" ] || echo_n "[bg$height];[bg$height][$logo:v]overlay=main_w-overlay_w-20:main_h-overlay_h-20" echo_n "[v$height]" @@ -206,7 +206,7 @@ filters_compose() { logo=$1; } filter_split_codec() { heights_webm=$1; heights_mpeg=$2; codeccount=$(valuedargcount "$@") - for height in $HEIGHTS; do + for height in $ENCODINGS; do echo_n "[v$height]split=$codeccount" printf_each '[v%swebm]' "$heights_webm" printf_each '[v%smpeg]' "$heights_mpeg" @@ -252,12 +252,12 @@ ffmpeg -hide_banner -threads auto \ ${LOGO:+-i "$LOGO"} \ ${HASVIDEO:+-filter_complex \ "$(filters_compose "${LOGO:+$((VSTREAMINDEX+1))}"); - $(filter_split_codec "$HEIGHTS_WEBM" "$HEIGHTS_MPEG")" } \ + $(filter_split_codec "$ENCODINGS_WEBM" "$ENCODINGS_MPEG")" } \ ${SAVEDIR:+\ ${DVCAM:+-map $((0${ALSA:++1})) \ -codec copy -f dv "$SAVESTEM.dv" }} \ - ${HEIGHTS_WEBM:+\ - ${HASAUDIO:+-map '0:a' }${HASVIDEO:+$(printf_each ' -map [v%swebm]' "$HEIGHTS_WEBM") } -shortest \ + ${ENCODINGS_WEBM:+\ + ${HASAUDIO:+-map '0:a' }${HASVIDEO:+$(printf_each ' -map [v%swebm]' "$ENCODINGS_WEBM") } -shortest \ ${HASAUDIO:+\ $(encode_opus) } \ ${HASVIDEO:+\ @@ -266,8 +266,8 @@ ffmpeg -hide_banner -threads auto \ "${HASAUDIO:+$(tee_rtp a 111 "$FIRSTPORT")} ${HASMULTIMEDIA:+|} ${HASVIDEO:+$(tee_rtp v 100 $((FIRSTPORT+2)))}" } \ - ${HEIGHTS_MPEG:+\ - ${HASAUDIO:+-map '0:a' }${HASVIDEO:+$(printf_each ' -map [v%smpeg]' "$HEIGHTS_MPEG") } -shortest \ + ${ENCODINGS_MPEG:+\ + ${HASAUDIO:+-map '0:a' }${HASVIDEO:+$(printf_each ' -map [v%smpeg]' "$ENCODINGS_MPEG") } -shortest \ ${HASAUDIO:+\ $(encode_aac) } \ ${HASVIDEO:+\ -- cgit v1.2.3