diff options
author | Jonas Smedegaard <dr@jones.dk> | 2017-05-16 14:20:01 +0200 |
---|---|---|
committer | Jonas Smedegaard <dr@jones.dk> | 2017-05-16 14:20:01 +0200 |
commit | c19b33c6eda0232d045df9f323524ec8d812c260 (patch) | |
tree | 3b5883a3875e7dd0dc57ebe22779cdcac2a3d27e /bin | |
parent | 5919275dde112187c5aeedeb7b4a76de8a7eb3dd (diff) |
Scale anamorphic to square-pixel as needed.
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/decode+edit | 3 | ||||
-rwxr-xr-x | bin/decode+edit+encode | 3 | ||||
-rwxr-xr-x | bin/decode+edit+encodeDV | 3 | ||||
-rwxr-xr-x | bin/decode+edit+loop+encode+stream | 3 | ||||
-rwxr-xr-x | bin/stream | 3 |
5 files changed, 10 insertions, 5 deletions
diff --git a/bin/decode+edit b/bin/decode+edit index 9f34d01..16c3155 100755 --- a/bin/decode+edit +++ b/bin/decode+edit @@ -13,11 +13,12 @@ HEIGHT=360 mkdir -p $(dirname "$OUTPUT") # + loop-in-filter trick based on http://video.stackexchange.com/a/16933 +# + scale to square pixels as needed ffmpeg -hide_banner -threads auto -y \ -i "$INPUT" \ -i "$LOGO" -filter_complex \ - "[0:v]scale=-2:$HEIGHT[bg]; + "[0:v]scale=iw*sar*$HEIGHT/ih:$HEIGHT,setsar=1[bg]; [bg][1:v]overlay=main_w-overlay_w-20:main_h-overlay_h-20[v]" \ -map '[v]' \ -f yuv4mpegpipe "$OUTPUT" diff --git a/bin/decode+edit+encode b/bin/decode+edit+encode index 1983b54..a0eb208 100755 --- a/bin/decode+edit+encode +++ b/bin/decode+edit+encode @@ -25,12 +25,13 @@ mkdir -p $(dirname "$OUTPUT") # based on http://www.webmproject.org/docs/encoder-parameters/#real-time-cbr-encoding-and-streaming # + scale+watermark trick based on http://stackoverflow.com/a/10937357 +# + scale to square pixels as needed # + Add 1s latency (deadline) ffmpeg -hide_banner -threads auto -y -re \ -i "$INPUT" \ -i "$LOGO" \ -filter_complex \ - "[0:v]scale=-2:$HEIGHT[bg]; + "[0:v]scale=iw*sar*$HEIGHT/ih:$HEIGHT,setsar=1[bg]; [bg][1:v]overlay=main_w-overlay_w-20:main_h-overlay_h-20[v]" \ -map '[v]' \ -pix_fmt yuv420p \ diff --git a/bin/decode+edit+encodeDV b/bin/decode+edit+encodeDV index c33635a..ef1474d 100755 --- a/bin/decode+edit+encodeDV +++ b/bin/decode+edit+encodeDV @@ -23,12 +23,13 @@ mkdir -p $(dirname "$OUTPUT") # based on http://www.webmproject.org/docs/encoder-parameters/#real-time-cbr-encoding-and-streaming # + scale+watermark trick based on http://stackoverflow.com/a/10937357 +# + scale to square pixels as needed # + Add 1s latency (deadline) ffmpeg -hide_banner -threads auto -y \ -i "$INPUT" \ -i "$LOGO" \ -filter_complex \ - "[0:v]scale=-2:$HEIGHT[bg]; + "[0:v]scale=iw*sar*$HEIGHT/ih:$HEIGHT,setsar=1[bg]; [bg][1:v]overlay=main_w-overlay_w-20:main_h-overlay_h-20[v]" \ -map '[v]' \ -target pal-dv "$OUTPUT" diff --git a/bin/decode+edit+loop+encode+stream b/bin/decode+edit+loop+encode+stream index 5dbe82d..ba70b02 100755 --- a/bin/decode+edit+loop+encode+stream +++ b/bin/decode+edit+loop+encode+stream @@ -35,13 +35,14 @@ fi # based on http://www.webmproject.org/docs/encoder-parameters/#real-time-cbr-encoding-and-streaming # + loop-in-filter trick based on http://video.stackexchange.com/a/16933 # + scale+watermark trick based on http://stackoverflow.com/a/10937357 +# + scale to square pixels as needed # + Add 1s latency (deadline) # + Use same RTP payload types as GStreamer ffmpeg -hide_banner -threads auto -re \ -f lavfi -i "movie=filename=$INPUT:loop=$ITERATIONS, setpts=N/(FRAME_RATE*TB)" \ -i "$LOGO" \ -filter_complex \ - "[0:v]scale=-2:$HEIGHT[bg]; + "[0:v]scale=iw*sar*$HEIGHT/ih:$HEIGHT,setsar=1[bg]; [bg][1:v]overlay=main_w-overlay_w-20:main_h-overlay_h-20[v]" \ -map '[v]' \ -pix_fmt yuv420p \ @@ -135,7 +135,7 @@ filter_split_height() { } filter_scale() { outstem=${1:-v}; for height in $HEIGHTS; do - echo_n "[s$height]scale=-2:$height[$outstem$height]" + echo_n "[s$height]scale=iw*sar*$height/ih:$height,setsar=1[$outstem$height]" done } filter_watermark() { @@ -153,6 +153,7 @@ tee_rtp() { stream=$1; pt=$2; port=$3; } # * scale+watermark trick based on http://stackoverflow.com/a/10937357 +# + scale to square pixels as needed # * routing based on http://trac.ffmpeg.org/wiki/Creating%20multiple%20outputs#Teepseudo-muxer # * VP8 encoding based on http://www.webmproject.org/docs/encoder-parameters/#real-time-cbr-encoding-and-streaming # + Add 1s latency (deadline) |