summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonas Smedegaard <dr@jones.dk>2017-05-12 12:19:47 +0200
committerJonas Smedegaard <dr@jones.dk>2017-05-12 12:19:47 +0200
commit3822b5e619e06c0da03ab56f77a008ecafcb944d (patch)
treec8742e78b400d3cc29602aaaafe89fe9723b4dda
parent9d5c00ff55c1e0d43e6a996f7628ec166a69351f (diff)
Set predictive GOP size for MPEG.
-rwxr-xr-xbin/stream4
1 files changed, 4 insertions, 0 deletions
diff --git a/bin/stream b/bin/stream
index d36902b..4c684eb 100755
--- a/bin/stream
+++ b/bin/stream
@@ -1,4 +1,6 @@
#!/bin/sh
+#
+# TODO: Set predictive GOP size for WebM (when tested that it works)
set -eu
@@ -139,6 +141,7 @@ tee_rtp() { stream=$1; pt=$2; port=$3;
# * 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)
+# * Predictive GOP size preserving scene-change GOP based on https://superuser.com/a/1098329
# * Use same RTP payload types as GStreamer
ffmpeg -hide_banner -threads auto \
${ALSA:+-f alsa -sample_rate "$AFRAMERATE" -channels "$ACHANNELS" -thread_queue_size 2048 -i "$ALSA"} \
@@ -179,4 +182,5 @@ ffmpeg -hide_banner -threads auto \
-pix_fmt yuv420p \
-codec:v libx264 -tune zerolatency -preset ultrafast \
-maxrate "$VBITRATE" -bufsize "$((VBITRATE*2))" -crf 23 } \
+ -force_key_frames 'expr:gte(t,n_forced*2)' \
-f rtp_mpegts rtp://$IP:10000 }