diff options
-rwxr-xr-x | bin/stream | 18 |
1 files changed, 6 insertions, 12 deletions
@@ -191,19 +191,15 @@ HEIGHTS=$(uniqwords "$HEIGHTS_WEBM $HEIGHTS_MPEG") [ -z "${SAVEDIR:-}" ] || SAVESTEM="${SAVEDIR:-}/$(date +%Y%m%d-%H%M%S)" [ -z "${SAVEDIR:-}" ] || export FFREPORT=file="$SAVESTEM.log" -filter_split_height() { +filters_compose() { logo=$1; heightcount=$(echo "$HEIGHTS" | wc --words) echo_n "[$VSTREAMINDEX:v]${DEINT:+$DEINT,}${VFRAMERATE:+framerate=$VFRAMERATE,}format=pix_fmts=yuv420p,split=$heightcount" printf_each '[s%s]' "$HEIGHTS" -} -filter_scale() { outstem=${1:-v}; - for height in $HEIGHTS; do - echo_n "[s$height]scale=iw*sar*$height/ih:$height,setsar=1[$outstem$height]" - done -} -filter_watermark() { + echo_n ';' for height in $HEIGHTS; do - echo_n "[bg$height][$((VSTREAMINDEX+1)):v]overlay=main_w-overlay_w-20:main_h-overlay_h-20[v$height]" + echo_n "[s$height]scale=iw*sar*$height/ih:$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]" done } filter_split_codec() { heights_webm=$1; heights_mpeg=$2; @@ -254,9 +250,7 @@ ffmpeg -hide_banner -threads auto \ ${VFILE:+-re${SEEK:+ -ss $SEEK} -i "$VFILE"} \ ${LOGO:+-i "$LOGO"} \ ${HASVIDEO:+-filter_complex \ - "$(filter_split_height); - $(filter_scale "${WINPUT:+bg}")${WINPUT:+${LOGO:+; - $(filter_watermark)}}; + "$(filters_compose "${LOGO:+$((VSTREAMINDEX+1))}"); $(filter_split_codec "$HEIGHTS_WEBM" "$HEIGHTS_MPEG")" } \ ${SAVEDIR:+\ ${DVCAM:+-map $((0${ALSA:++1})) \ |