From 4fe8ee6bdc82dfe0587d91cc3d5db36e436544ad Mon Sep 17 00:00:00 2001 From: Jonas Smedegaard Date: Fri, 28 Apr 2017 01:21:12 +0200 Subject: Handle video-only or audio-only streams. --- bin/stream | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'bin/stream') 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"} -- cgit v1.2.3