From 992ca80124f251f06c96fe15465880513ad4eee7 Mon Sep 17 00:00:00 2001 From: Jonas Smedegaard Date: Thu, 8 Jun 2017 17:19:36 +0200 Subject: Make GOP optional, and set only for H.264 (not VP8). --- bin/stream | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'bin') diff --git a/bin/stream b/bin/stream index 154d2a5..1e26d11 100755 --- a/bin/stream +++ b/bin/stream @@ -228,18 +228,18 @@ encode_opus() { encode_aac() { echo_n "-codec:a aac -strict experimental -ac $ACHANNELS -ar $AFRAMERATE_AAC -b:a $((ACHANNELS*ABITRATE_AAC))" } -encode_vp8() { bitrate=$1; speed=$2; +encode_vp8() { bitrate=$1; speed=$2; gop=$3; echo_n "-codec:v vp8 -quality realtime -deadline 1000000 -cpu-used $speed \ -b:v $bitrate -minrate $bitrate -maxrate $bitrate \ -undershoot-pct 95 -bufsize $((6000*bitrate/1000)) -rc_init_occupancy $((4000*bitrate/1000)) \ -max-intra-rate 0 \ - -qmin 4 -qmax 56 \ - -force_key_frames expr:gte(t,n_forced*2)" + -qmin 4 -qmax 56" +[ -z "$gop" ] || echo_n " -force_key_frames expr:gte(t,n_forced*$gop)" } -encode_x264() { bitrate=$1; speed=$2; +encode_x264() { bitrate=$1; speed=$2; gop=$3; echo_n "-codec:v libx264 -preset $speed -tune zerolatency \ - -maxrate $bitrate -bufsize $((bitrate*2)) -crf 23 \ - -force_key_frames expr:gte(t,n_forced*2)" + -maxrate $bitrate -bufsize $((bitrate*2)) -crf 23" +[ -z "$gop" ] || echo_n " -force_key_frames expr:gte(t,n_forced*$gop)" } # * routing based on http://trac.ffmpeg.org/wiki/Creating%20multiple%20outputs#Teepseudo-muxer @@ -309,5 +309,5 @@ ffmpeg -hide_banner -threads auto \ ${HASAUDIO:+\ $(encode_aac) } \ ${HASVIDEO:+\ - $(encode_x264 "$VBITRATE" "$SPEED_X264") } \ + $(encode_x264 "$VBITRATE" "$SPEED_X264" 2) } \ $(mux "$TARGETS_MPEG") } -- cgit v1.2.3