From 39bc48eb0e8b9a2b8d43d6f1a612c12d0c70ae23 Mon Sep 17 00:00:00 2001 From: Jonas Smedegaard Date: Thu, 18 May 2017 08:46:41 +0200 Subject: Convert pixel format explictly as filter (not implicitly as constraint, for each encoding). --- bin/decode+edit+encode | 3 +-- bin/decode+edit+loop+encode+stream | 3 +-- bin/encodevideo+loop+stream | 2 +- bin/loop+encode+stream | 2 +- bin/stream | 4 +--- 5 files changed, 5 insertions(+), 9 deletions(-) diff --git a/bin/decode+edit+encode b/bin/decode+edit+encode index f21ef51..deb732a 100755 --- a/bin/decode+edit+encode +++ b/bin/decode+edit+encode @@ -39,10 +39,9 @@ ffmpeg -hide_banner -threads auto -y -re \ -i "$INPUT" \ -i "$LOGO" \ -filter_complex \ - "[0:v]scale=iw*sar*$HEIGHT/ih:$HEIGHT,setsar=1[bg]; + "[0:v]format=pix_fmts=yuv420p,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 \ -codec:v vp8 -quality realtime -deadline 1000000 -cpu-used "$SPEED_VP8" \ -b:v "$VBITRATE" -minrate "$VBITRATE" -maxrate "$VBITRATE" \ -undershoot-pct 95 -bufsize $((6000*VBITRATE/1000)) -rc_init_occupancy $((4000*VBITRATE/1000)) \ diff --git a/bin/decode+edit+loop+encode+stream b/bin/decode+edit+loop+encode+stream index 8904a4a..6e65697 100755 --- a/bin/decode+edit+loop+encode+stream +++ b/bin/decode+edit+loop+encode+stream @@ -64,10 +64,9 @@ 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=iw*sar*$HEIGHT/ih:$HEIGHT,setsar=1[bg]; + "[0:v]format=pix_fmts=yuv420p,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 \ -codec:v vp8 -quality realtime -deadline 1000000 -cpu-used "$SPEED_VP8" \ -b:v "$VBITRATE" -minrate "$VBITRATE" -maxrate "$VBITRATE" \ -undershoot-pct 95 -bufsize $((6000*VBITRATE/1000)) -rc_init_occupancy $((4000*VBITRATE/1000)) \ diff --git a/bin/encodevideo+loop+stream b/bin/encodevideo+loop+stream index 266a733..b054782 100755 --- a/bin/encodevideo+loop+stream +++ b/bin/encodevideo+loop+stream @@ -54,8 +54,8 @@ fi # + Use same RTP payload types as GStreamer ffmpeg -hide_banner -threads auto -re \ -stream_loop -1 -i "$INPUT" \ + -vf format=pix_fmts=yuv420p \ -map '0:v' \ - -pix_fmt yuv420p \ -codec:v vp8 -quality realtime -deadline 1000000 -cpu-used "$SPEED_VP8" \ -b:v "$VBITRATE" -minrate "$VBITRATE" -maxrate "$VBITRATE" \ -undershoot-pct 95 -bufsize $((6000*VBITRATE/1000)) -rc_init_occupancy $((4000*VBITRATE/1000)) \ diff --git a/bin/loop+encode+stream b/bin/loop+encode+stream index 5beef2d..3906552 100755 --- a/bin/loop+encode+stream +++ b/bin/loop+encode+stream @@ -60,11 +60,11 @@ fi # + Use same RTP payload types as GStreamer ffmpeg -hide_banner -threads auto -re \ -stream_loop -1 -i "$INPUT" \ + -vf format=pix_fmts=yuv420p \ -map '0:a' \ -codec:a libopus -ac "$ACHANNELS" -ar "$AFRAMERATE_OPUS" -b:a "$ABITRATE_OPUS" \ -f rtp -payload_type 111 "rtp://$IP:$FIRSTPORT?pkt_size=1200" \ -map '0:v' \ - -pix_fmt yuv420p \ -codec:v vp8 -quality realtime -deadline 1000000 -cpu-used "$SPEED_VP8" \ -b:v "$VBITRATE" -minrate "$VBITRATE" -maxrate "$VBITRATE" \ -undershoot-pct 95 -bufsize $((6000*VBITRATE/1000)) -rc_init_occupancy $((4000*VBITRATE/1000)) \ diff --git a/bin/stream b/bin/stream index a66d869..ce90206 100755 --- a/bin/stream +++ b/bin/stream @@ -160,7 +160,7 @@ HEIGHTS=$(uniqwords "$HEIGHTS_WEBM $HEIGHTS_MPEG") filter_split_height() { heightcount=$(echo "$HEIGHTS" | wc --words) - echo_n "[$VSTREAMINDEX:v]${DEINT:+$DEINT,}split=$heightcount" + echo_n "[$VSTREAMINDEX:v]${DEINT:+$DEINT,}format=pix_fmts=yuv420p,split=$heightcount" printf_each '[s%s]' "$HEIGHTS" } filter_scale() { outstem=${1:-v}; @@ -209,7 +209,6 @@ ffmpeg -hide_banner -threads auto \ ${HASAUDIO:+\ -codec:a libopus -ac "$ACHANNELS" -ar "$AFRAMERATE_OPUS" -b:a "$ABITRATE_OPUS" } \ ${HASVIDEO:+\ - -pix_fmt yuv420p \ -codec:v vp8 -quality realtime -deadline 1000000 -cpu-used "$SPEED_VP8" \ -b:v "$VBITRATE" -minrate "$VBITRATE" -maxrate "$VBITRATE" \ -undershoot-pct 95 -bufsize $((6000*VBITRATE/1000)) -rc_init_occupancy $((4000*VBITRATE/1000)) \ @@ -225,7 +224,6 @@ ffmpeg -hide_banner -threads auto \ ${HASAUDIO:+\ -codec:a aac -strict experimental -ac "$ACHANNELS" -ar "$AFRAMERATE_AAC" -b:a $((ACHANNELS*ABITRATE_AAC)) } \ ${HASVIDEO:+\ - -pix_fmt yuv420p \ -codec:v libx264 -preset "$SPEED_X264" -tune zerolatency \ -maxrate "$VBITRATE" -bufsize "$((VBITRATE*2))" -crf 23 } \ -force_key_frames 'expr:gte(t,n_forced*2)' \ -- cgit v1.2.3