summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorJonas Smedegaard <dr@jones.dk>2017-04-28 02:02:22 +0200
committerJonas Smedegaard <dr@jones.dk>2017-04-28 02:02:22 +0200
commitc9889f639d8d4a48e3358816c1f7dba923b96954 (patch)
tree9ceb952ccc277a5c9f94052b145008bb6886d88d /bin
parent6ccb121b1d82e037ee94b239b43057647f7fe8d7 (diff)
Support saving a copy of inputs to SAVEDIR.
Diffstat (limited to 'bin')
-rwxr-xr-xbin/stream4
1 files changed, 4 insertions, 0 deletions
diff --git a/bin/stream b/bin/stream
index 7270f6b..f20c589 100755
--- a/bin/stream
+++ b/bin/stream
@@ -80,6 +80,7 @@ VBITRATE=256000
# + scale+watermark trick based on http://stackoverflow.com/a/10937357
# + Add 1s latency (deadline)
# + Use same RTP payload types as GStreamer
+${SAVEDIR:+export FFREPORT=file="$SAVEDIR/%t.log"}
ffmpeg -hide_banner -threads auto -re \
${ALSA:+-f alsa -sample_rate "$AFRAMERATE" -channels "$ACHANNELS" -thread_queue_size 1024 -i "$ALSA"} \
${DVCAM:+-f iec61883 -i $DVCAM} \
@@ -90,6 +91,9 @@ ffmpeg -hide_banner -threads auto -re \
${MAYBEVIDEO:+-filter_complex \
"[$VSTREAMINDEX:v]scale=-1:$HEIGHT${WATERMARK:-[v]}${WATERMARK:+[bg]${LOGO:+;
[bg][$((VSTREAMINDEX+1)):v]overlay=main_w-overlay_w-20:main_h-overlay_h-20[v]}}"} \
+ ${SAVEDIR:+-map ':a?' -map ':v?' \
+ -codec copy \
+ -f matroska "file:$SAVEDIR/$(date +%Y%m%d-%H%M%S).mkv"} \
${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"} \