summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorJonas Smedegaard <dr@jones.dk>2017-05-05 13:42:07 +0200
committerJonas Smedegaard <dr@jones.dk>2017-05-05 13:42:07 +0200
commit8e878f219d7485bfc0dba17c59960788d0df9115 (patch)
tree75cebf98c251ccf8f3f84e568bbefc1a70f40daa /bin
parente7a3f676262d58dc0e9d48a0c8b12ca4b507177d (diff)
Prepare for multiple heights.
Diffstat (limited to 'bin')
-rwxr-xr-xbin/stream18
1 files changed, 11 insertions, 7 deletions
diff --git a/bin/stream b/bin/stream
index 38902d2..452f47e 100755
--- a/bin/stream
+++ b/bin/stream
@@ -77,8 +77,11 @@ ABITRATE=32000
HEIGHT=360
VBITRATE=256000
-MKWEBM='[webm]'
-MKMPEG='[mpeg]'
+# FIXME: support multiple heights
+HEIGHTCOUNT=1
+height=$HEIGHT
+MKWEBM="[v${height}webm]"
+MKMPEG="[v${height}mpeg]"
[ -z "$MKWEBM" ] || VCODECCOUNT=$((VCODECCOUNT+1))
[ -z "$MKMPEG" ] || VCODECCOUNT=$((VCODECCOUNT+1))
@@ -99,16 +102,17 @@ ffmpeg -hide_banner -threads auto -re \
${VFILE:+-i "$VFILE"} \
${LOGO:+-i "$LOGO"} \
${HASVIDEO:+-filter_complex \
- "[$VSTREAMINDEX:v]scale=-2:$HEIGHT${WATERMARK:-[v]}${WATERMARK:+[bg]${LOGO:+;
- [bg][$((VSTREAMINDEX+1)):v]overlay=main_w-overlay_w-20:main_h-overlay_h-20[v]}};
- [v]split=$VCODECCOUNT$MKWEBM$MKMPEG" } \
+ "[$VSTREAMINDEX:v]split=$HEIGHTCOUNT[s$height];
+ [s$height]scale=-2:$height${WATERMARK:-[v$height]}${WATERMARK:+[bg$height]${LOGO:+;
+ [bg$height][$((VSTREAMINDEX+1)):v]overlay=main_w-overlay_w-20:main_h-overlay_h-20[v$height]}};
+ [v$height]split=$VCODECCOUNT$MKWEBM$MKMPEG" } \
${SAVEDIR:+-map '0:' ${TWOSOURCES:+-map '1:'} \
-codec copy \
-f segment -segment_format matroska -segment_format_options live=1:reserve_index_space=512kB \
-segment_list "$SAVESTEM.ffconcat" -segment_list_flags live \
-segment_time 600 -segment_atclocktime 1 -strftime 1 "$SAVESTEM-%H%M.mkv"} \
${MKWEBM:+\
- ${HASAUDIO:+-map '0:a' } ${HASVIDEO:+-map '[webm]' } \
+ ${HASAUDIO:+-map '0:a' } ${HASVIDEO:+-map "[v${height}webm]" } \
${HASAUDIO:+\
-codec:a libopus -ac "$ACHANNELS" -ar "$AFRAMERATE" -b:a "$ABITRATE" } \
${HASVIDEO:+\
@@ -122,7 +126,7 @@ ffmpeg -hide_banner -threads auto -re \
"${HASAUDIO:+[select=\'a\':f=rtp:payload_type=111]rtp://$IP:$FIRSTPORT?pkt_size=1200| \
}${HASVIDEO:+[select=\'v\':f=rtp:payload_type=100]rtp://$IP:$((FIRSTPORT+2))?pkt_size=1200}" } \
${MKMPEG:+\
- ${HASAUDIO:+-map '0:a' } ${HASVIDEO:+-map '[mpeg]' } \
+ ${HASAUDIO:+-map '0:a' } ${HASVIDEO:+-map "[v${height}mpeg]" } \
${HASAUDIO:+\
-codec:a aac -strict experimental -ac "$ACHANNELS" -ar 44100 -b:a $((ACHANNELS*64))k } \
${HASVIDEO:+\