diff options
author | Jonas Smedegaard <dr@jones.dk> | 2017-05-22 10:12:14 +0200 |
---|---|---|
committer | Jonas Smedegaard <dr@jones.dk> | 2017-05-22 10:12:14 +0200 |
commit | e1d887a8abe66e6ae288023e1566f717ef2502e2 (patch) | |
tree | 1c12da8daadaf80e3f3c7f059ca8ef06e1921fa7 | |
parent | cfb73b983efc6dbc6f0d3ae8ee89b600c8a70999 (diff) |
Merge functions filter_split_height() filter_scale() → filters_compose().
-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})) \ |