summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonas Smedegaard <dr@jones.dk>2017-05-16 13:56:49 +0200
committerJonas Smedegaard <dr@jones.dk>2017-05-16 13:56:49 +0200
commit8dcd0a663d409ae42d5ae2fb9f73a8c29f46a2d3 (patch)
tree2b2b842ca80e3c6c0870ce38c8865fddfab52b95
parent4cf5f65c2eb911b3f94cbbaa8480b588173a3fd8 (diff)
Rename and split variable AFRAMERATE → AFRAMERATE_SRC AFRAMERATE_OPUS AFRAMERATE_AAC.
-rwxr-xr-xbin/loop+encode+stream4
-rwxr-xr-xbin/stream10
2 files changed, 8 insertions, 6 deletions
diff --git a/bin/loop+encode+stream b/bin/loop+encode+stream
index cc21629..fc944fe 100755
--- a/bin/loop+encode+stream
+++ b/bin/loop+encode+stream
@@ -16,7 +16,7 @@ fi
FIRSTPORT=${2:-5002} # even number - next 3 ports used too
ACHANNELS=2
-AFRAMERATE=48000
+AFRAMERATE_OPUS=48000
ABITRATE=32000
# TODO
@@ -37,7 +37,7 @@ fi
ffmpeg -hide_banner -threads auto -re \
-stream_loop -1 -i "$INPUT" \
-map '0:a' \
- -codec:a libopus -ac "$ACHANNELS" -ar "$AFRAMERATE" -b:a "$ABITRATE" \
+ -codec:a libopus -ac "$ACHANNELS" -ar "$AFRAMERATE_OPUS" -b:a "$ABITRATE" \
-f rtp -payload_type 111 "rtp://$IP:$FIRSTPORT?pkt_size=1200" \
-map '0:v' \
-pix_fmt yuv420p \
diff --git a/bin/stream b/bin/stream
index 8a9c4e3..0734f83 100755
--- a/bin/stream
+++ b/bin/stream
@@ -77,7 +77,9 @@ VSTREAMINDEX=1
FIRSTPORT=${FIRSTPORT:-5002} # even number - next 7 ports used too
ACHANNELS=1
-AFRAMERATE=24000
+AFRAMERATE_SRC=24000
+AFRAMERATE_OPUS=24000
+AFRAMERATE_AAC=44100
ABITRATE=16000
# FIXME: support multiple heights
@@ -153,7 +155,7 @@ tee_rtp() { stream=$1; pt=$2; port=$3;
# * 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" -channels "$ACHANNELS" -thread_queue_size 2048 -i "$ALSA"} \
+ ${ALSA:+-f alsa -sample_rate "$AFRAMERATE_SRC" -channels "$ACHANNELS" -thread_queue_size 2048 -i "$ALSA"} \
${DVCAM:+-f iec61883 -thread_queue_size 64 -i $DVCAM} \
${XFILE:+-re${SEEK:+ -ss $SEEK} -i "$XFILE"} \
${IIDC:+-f libdc1394 -video_size 640x480 -framerate 15 -thread_queue_size 256 -i "$IIDC"} \
@@ -170,7 +172,7 @@ ffmpeg -hide_banner -threads auto \
${HEIGHTS_WEBM:+\
${HASAUDIO:+-map '0:a' }${HASVIDEO:+$(printf_each ' -map [v%swebm]' "$HEIGHTS_WEBM") } -shortest \
${HASAUDIO:+\
- -codec:a libopus -ac "$ACHANNELS" -ar "$AFRAMERATE" -b:a "$ABITRATE" } \
+ -codec:a libopus -ac "$ACHANNELS" -ar "$AFRAMERATE_OPUS" -b:a "$ABITRATE" } \
${HASVIDEO:+\
-pix_fmt yuv420p \
-codec:v vp8 -quality realtime -deadline 1000000 -cpu-used 15 \
@@ -186,7 +188,7 @@ ffmpeg -hide_banner -threads auto \
${HEIGHTS_MPEG:+\
${HASAUDIO:+-map '0:a' }${HASVIDEO:+$(printf_each ' -map [v%smpeg]' "$HEIGHTS_MPEG") } -shortest \
${HASAUDIO:+\
- -codec:a aac -strict experimental -ac "$ACHANNELS" -ar 44100 -b:a $((ACHANNELS*64))k } \
+ -codec:a aac -strict experimental -ac "$ACHANNELS" -ar "$AFRAMERATE_AAC" -b:a $((ACHANNELS*64))k } \
${HASVIDEO:+\
-pix_fmt yuv420p \
-codec:v libx264 -tune zerolatency -preset ultrafast \