summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonas Smedegaard <dr@jones.dk>2017-05-22 14:33:29 +0200
committerJonas Smedegaard <dr@jones.dk>2017-05-22 14:33:29 +0200
commitc56868be49dc64d215cee8f01825b8dddd7108b6 (patch)
treedf3c799c81f39a72cb99cb74cb61189db30f1bdb
parent5ecc03eb39f4634968214c850aacd7078738b7b0 (diff)
Generalize and rename function mux_webm() → mux().
-rwxr-xr-xbin/stream14
1 files changed, 7 insertions, 7 deletions
diff --git a/bin/stream b/bin/stream
index 502fff5..6981a28 100755
--- a/bin/stream
+++ b/bin/stream
@@ -238,21 +238,21 @@ encode_x264() { bitrate=$1; speed=$2;
# * routing based on http://trac.ffmpeg.org/wiki/Creating%20multiple%20outputs#Teepseudo-muxer
# * Use same RTP payload types as GStreamer
-mux_webm() {
- targetcount=$(echo "$TARGETS_WEBM" | wc --words)
+mux() { targets="$1";
+ targetcount=$(echo "$targets" | wc --words)
if [ $targetcount -lt 2 ]; then
- case "$TARGETS_WEBM" in
+ case "$targets" in
rtp_opus) echo_n "-f rtp -payload_type 111 rtp://$IP:$FIRSTPORT?pkt_size=1440";;
rtp_vp8) echo_n "-f rtp -payload_type 100 rtp://$IP:$((FIRSTPORT+2))?pkt_size=1440";;
- *) exit1 "Unsupported muxing $TARGETS_WEBM";;
+ *) exit1 "Unknown target $targets";;
esac
else
echo_n "-f tee "
- for muxing in $TARGETS_WEBM; do
+ for muxing in $targets; do
case "$muxing" in
rtp_opus) echo_n "[select=\'a\':f=rtp:payload_type=111]rtp://$IP:$FIRSTPORT?pkt_size=1440";;
rtp_vp8) echo_n "[select=\'v\':f=rtp:payload_type=100]rtp://$IP:$((FIRSTPORT+2))?pkt_size=1440";;
- *) exit1 "Unsupported muxing $muxing";;
+ *) exit1 "Unknown target $muxing";;
esac
targetcount=$((targetcount-1))
[ $targetcount -lt 1 ] || echo_n '|'
@@ -281,7 +281,7 @@ ffmpeg -hide_banner -threads auto \
$(encode_opus) } \
${HASVIDEO:+\
$(encode_vp8 "$VBITRATE" "$SPEED_VP8") } \
- $(mux_webm) } \
+ $(mux "$TARGETS_WEBM") } \
${ENCODINGS_MPEG:+\
${HASAUDIO:+-map '0:a' }${HASVIDEO:+$(printf_each ' -map [v%smpeg]' "$ENCODINGS_MPEG") } -shortest \
${HASAUDIO:+\