summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
Diffstat (limited to 'bin')
-rwxr-xr-xbin/stream12
1 files changed, 8 insertions, 4 deletions
diff --git a/bin/stream b/bin/stream
index a0a2fae..f3fa019 100755
--- a/bin/stream
+++ b/bin/stream
@@ -103,6 +103,10 @@ printf_each() {
done
}
+# shellcheck disable=SC2059
+tee_rtp() { stream=$1; pt=$2; port=$3;
+ printf "[select=\'$stream\':f=rtp:payload_type=$pt]rtp://$IP:$port?pkt_size=1200"; }
+
# * scale+watermark trick based on http://stackoverflow.com/a/10937357
# * 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
@@ -138,9 +142,9 @@ ffmpeg -hide_banner -threads auto -re \
-qmin 4 -qmax 56 } \
-f tee \
"${HASAUDIO:+\
- [select=\'a\':f=rtp:payload_type=111]rtp://$IP:$FIRSTPORT?pkt_size=1200| \
+ $(tee_rtp a 111 "$FIRSTPORT")|\
}${HASVIDEO:+\
- [select=\'v\':f=rtp:payload_type=100]rtp://$IP:$((FIRSTPORT+2))?pkt_size=1200}" } \
+ $(tee_rtp v 100 $((FIRSTPORT+2)))}" } \
${HEIGHTS_MPEG:+\
${HASAUDIO:+-map '0:a' }${HASVIDEO:+$(printf_each ' -map [v%smpeg]' "$HEIGHTS_MPEG") } \
${HASAUDIO:+\
@@ -151,6 +155,6 @@ ffmpeg -hide_banner -threads auto -re \
-maxrate "$VBITRATE" -bufsize "$((VBITRATE*2))" -crf 23 } \
-f tee \
"${HASAUDIO:+\
- [select=\'a\':f=rtp:payload_type=96]rtp://$IP:$((FIRSTPORT+4))?pkt_size=1200| \
+ $(tee_rtp a 96 $((FIRSTPORT+4)))|\
}${HASVIDEO:+\
- [select=\'v\':f=rtp:payload_type=97]rtp://$IP:$((FIRSTPORT+6))?pkt_size=1200}" }
+ $(tee_rtp v 97 $((FIRSTPORT+6)))}" }