summaryrefslogtreecommitdiff
path: root/bin/stream
diff options
context:
space:
mode:
authorJonas Smedegaard <dr@jones.dk>2017-04-28 01:21:12 +0200
committerJonas Smedegaard <dr@jones.dk>2017-04-28 01:21:12 +0200
commit4fe8ee6bdc82dfe0587d91cc3d5db36e436544ad (patch)
tree22f3047a36aa9e084c7bb33efa56fa59597eb0e1 /bin/stream
parent70844759a6d289825aff588f5bed3d7253ffdb24 (diff)
Handle video-only or audio-only streams.
Diffstat (limited to 'bin/stream')
-rwxr-xr-xbin/stream14
1 files changed, 8 insertions, 6 deletions
diff --git a/bin/stream b/bin/stream
index 1755141..59d7c20 100755
--- a/bin/stream
+++ b/bin/stream
@@ -60,6 +60,8 @@ fi
[ -z "$VINPUT" ] || [ $VINPUT -eq 1 ] || exit1 "Too many arguments: Max. 1 video source"
[ -z "$WINPUT" ] || [ $WINPUT -eq 1 ] || exit1 "Too many arguments: Max. 1 watermark source"
[ -z "$XINPUT" ] || [ $XINPUT -eq 1 ] || exit1 "Too many arguments: Max. 1 multimedia source"
+[ -n "$NOAUDIO" ] || [ -z "$AINPUT$XINPUT" ] || MAYBEAUDIO=1
+[ -n "$NOVIDEO" ] || [ -z "$VINPUT$XINPUT" ] || MAYBEVIDEO=1
VSTREAMINDEX=1
[ -n "$AINPUT" ] || VSTREAMINDEX=0
@@ -82,17 +84,17 @@ ffmpeg -hide_banner -threads auto -re \
${XFILE:+-i "$XFILE"} \
${IIDC:+-f libdc1394 -video_size 640x480 -framerate 15 -thread_queue_size 256 -i "$IIDC"} \
${LOGO:+-i "$LOGO"} \
- -filter_complex \
+ ${MAYBEVIDEO:+-filter_complex \
"[$VSTREAMINDEX:v]scale=-1:$HEIGHT[bg]${LOGO:+;
- [bg][$((VSTREAMINDEX+1)):v]overlay=main_w-overlay_w-20:main_h-overlay_h-20[v]}" \
- -map '0:a' \
+ [bg][$((VSTREAMINDEX+1)):v]overlay=main_w-overlay_w-20:main_h-overlay_h-20[v]}"} \
+ ${MAYBEAUDIO:+-map '0:a' \
-codec:a libopus -ac "$ACHANNELS" -ar "$AFRAMERATE" -b:a "$ABITRATE" \
- -f rtp -payload_type 111 "rtp://$IP:$FIRSTPORT?pkt_size=1200" \
- -map '[v]' \
+ -f rtp -payload_type 111 "rtp://$IP:$FIRSTPORT?pkt_size=1200"} \
+ ${MAYBEVIDEO:+-map '[v]' \
-pix_fmt yuv420p \
-codec:v vp8 -quality realtime -deadline 1000000 -cpu-used 15 \
-b:v "$VBITRATE" -minrate "$VBITRATE" -maxrate "$VBITRATE" \
-undershoot-pct 95 -bufsize $((6000*VBITRATE/1000)) -rc_init_occupancy $((4000*VBITRATE/1000)) \
-max-intra-rate 0 \
-qmin 4 -qmax 56 \
- -f rtp -payload_type 100 "rtp://$IP:$((FIRSTPORT+2))?pkt_size=1200"
+ -f rtp -payload_type 100 "rtp://$IP:$((FIRSTPORT+2))?pkt_size=1200"}