summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
Diffstat (limited to 'bin')
-rwxr-xr-xbin/send-gst-rtp-v-a17
1 files changed, 10 insertions, 7 deletions
diff --git a/bin/send-gst-rtp-v-a b/bin/send-gst-rtp-v-a
index 912100a..cd7b4c4 100755
--- a/bin/send-gst-rtp-v-a
+++ b/bin/send-gst-rtp-v-a
@@ -25,13 +25,17 @@ AUDIORATE=48000
VCAPS=video/x-raw,height="$HEIGHT"
ACAPS=audio/x-raw,rate="$AUDIORATE",channels=2,depth=16
+# * force threads using queues - see http://stackoverflow.com/a/30738533
+# * generous queue sizes inspired by https://wiki.xiph.org/GST_cookbook
+QUEUE=" queue max-size-bytes=100000000 max-size-time=0"
+
case "$VFORMAT" in
H264)
# * let x264 use low-latency sliced-threads (i.e. don't disable treads)
- VENC="x264enc speed-preset=ultrafast tune=zerolatency bitrate=800 byte-stream=true key-int-max=15 intra-refresh=true option-string=\"slice-max-size=8192:vbv-maxrate=80:vbv-bufsize=10\" ! video/x-h264,profile=baseline ! rtph264pay"
+ VENC="x264enc speed-preset=ultrafast tune=zerolatency bitrate=800 byte-stream=true key-int-max=15 intra-refresh=true option-string=\"slice-max-size=8192:vbv-maxrate=80:vbv-bufsize=10\" ! video/x-h264,profile=baseline ! $QUEUE ! rtph264pay"
;;
VP8)
- VENC="vp8enc min_quantizer=10 max_quantizer=10 cpu-used=10 deadline=1000000 ! video/x-vp8 ! rtpvp8pay"
+ VENC="vp8enc min_quantizer=10 max_quantizer=10 cpu-used=10 deadline=1000000 ! video/x-vp8 ! $QUEUE ! rtpvp8pay"
;;
RAW|'')
VENC="rtpvrawpay"
@@ -40,10 +44,10 @@ esac
case "$AFORMAT" in
AMR)
- AENC="amrnbenc ! rtpamrpay"
+ AENC="amrnbenc ! $QUEUE ! rtpamrpay"
;;
OPUS)
- AENC="opusenc ! rtpopuspay"
+ AENC="opusenc ! $QUEUE ! rtpopuspay"
;;
RAW|'')
AENC="rtpL16pay"
@@ -65,10 +69,9 @@ stream() {
}
n=0
-# * force threads using queues - see http://stackoverflow.com/a/30738533
gst-launch-1.0 -v \
rtpbin name=rtpbin \
- $(for dev in $VDEVICES; do n=$((n+1)); stream "$n" "v4l2src device=$dev ! queue ! videoconvert ! queue ! $VCAPS ! queue ! $VENC ! queue"; done; \
- for dev in $ADEVICES; do n=$((n+1)); stream "$n" "alsasrc device=$dev ! audioconvert ! $AENC ! queue"; done)
+ $(for dev in $VDEVICES; do n=$((n+1)); stream "$n" "v4l2src device=$dev ! $QUEUE ! videoconvert ! $VCAPS ! $QUEUE ! $VENC ! $QUEUE"; done; \
+ for dev in $ADEVICES; do n=$((n+1)); stream "$n" "alsasrc device=$dev ! $QUEUE ! audioconvert ! $QUEUE ! $AENC ! $QUEUE"; done)
set -e