summaryrefslogtreecommitdiff
path: root/bin/stream
diff options
context:
space:
mode:
authorJonas Smedegaard <dr@jones.dk>2017-05-22 10:39:15 +0200
committerJonas Smedegaard <dr@jones.dk>2017-05-22 10:39:15 +0200
commit25b0b8557174df8a8c5bedfe62a3a5342361e686 (patch)
treefbfebb0c512cd238e41942b06e4de69d3d892fd1 /bin/stream
parent2998ad0e37e0f8c26706ef2af68ec09f14ceae15 (diff)
Move comments where they belong.
Diffstat (limited to 'bin/stream')
-rwxr-xr-xbin/stream15
1 files changed, 8 insertions, 7 deletions
diff --git a/bin/stream b/bin/stream
index c350ce7..791df36 100755
--- a/bin/stream
+++ b/bin/stream
@@ -191,6 +191,8 @@ HEIGHTS=$(uniqwords "$HEIGHTS_WEBM $HEIGHTS_MPEG")
[ -z "${SAVEDIR:-}" ] || SAVESTEM="${SAVEDIR:-}/$(date +%Y%m%d-%H%M%S)"
[ -z "${SAVEDIR:-}" ] || export FFREPORT=file="$SAVESTEM.log"
+# * scale+watermark trick based on http://stackoverflow.com/a/10937357
+# + scale to square pixels as needed
filters_compose() { logo=$1;
heightcount=$(echo "$HEIGHTS" | wc --words)
echo_n "[$VSTREAMINDEX:v]${DEINT:+$DEINT,}${VFRAMERATE:+framerate=$VFRAMERATE,}format=pix_fmts=yuv420p,split=$heightcount"
@@ -211,6 +213,9 @@ filter_split_codec() { heights_webm=$1; heights_mpeg=$2;
done
}
+# * VP8 encoding based on http://www.webmproject.org/docs/encoder-parameters/#real-time-cbr-encoding-and-streaming
+# + Add 1s latency (deadline)
+# * Predictive GOP size preserving scene-change GOP based on https://superuser.com/a/1098329
encode_opus() {
echo_n "-codec:a libopus -ac $ACHANNELS -ar $AFRAMERATE_OPUS -b:a $ABITRATE_OPUS"
}
@@ -230,17 +235,13 @@ encode_x264() { bitrate=$1; speed=$2;
-maxrate $bitrate -bufsize $((bitrate*2)) -crf 23 \
-force_key_frames expr:gte(t,n_forced*2)"
}
+
+# * routing based on http://trac.ffmpeg.org/wiki/Creating%20multiple%20outputs#Teepseudo-muxer
+# * Use same RTP payload types as GStreamer
tee_rtp() { stream=$1; pt=$2; port=$3;
echo_n "[select=\'$stream\':f=rtp:payload_type=$pt]rtp://$IP:$port?pkt_size=1440"
}
-# * scale+watermark trick based on http://stackoverflow.com/a/10937357
-# + scale to square pixels as needed
-# * 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
-# + Add 1s latency (deadline)
-# * Predictive GOP size preserving scene-change GOP based on https://superuser.com/a/1098329
-# * Use same RTP payload types as GStreamer
ffmpeg -hide_banner -threads auto \
${ALSA:+-f alsa -sample_rate "$AFRAMERATE_SRC" -channels "$ACHANNELS" -thread_queue_size 2048 -i "$ALSA"} \
${DVCAM:+-f iec61883 -thread_queue_size 64 -i $DVCAM} \