aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2014-01-03 22:07:01 +0100
committerMatthias P. Braendli <matthias.braendli@mpb.li>2014-01-03 22:07:01 +0100
commitdde8490b0b522fd5fd9ba9ec4438b20546281faf (patch)
tree48395ad18a10ad028a8eacc495e5cd9a6be8fd7a
parent80b324e915e972adee078ac1dc5cf1848de00eb7 (diff)
downloadmmbtools-aux-dde8490b0b522fd5fd9ba9ec4438b20546281faf.tar.gz
mmbtools-aux-dde8490b0b522fd5fd9ba9ec4438b20546281faf.tar.bz2
mmbtools-aux-dde8490b0b522fd5fd9ba9ec4438b20546281faf.zip
add encode-alsasrc-gst-dabplus.sh
-rwxr-xr-xencode-alsasrc-gst-dabplus.sh39
1 files changed, 39 insertions, 0 deletions
diff --git a/encode-alsasrc-gst-dabplus.sh b/encode-alsasrc-gst-dabplus.sh
new file mode 100755
index 0000000..48970b2
--- /dev/null
+++ b/encode-alsasrc-gst-dabplus.sh
@@ -0,0 +1,39 @@
+#!/bin/bash
+#
+# Read audio from ALSA input using gstreamer, and encode with fdk-aac-dabplus-zmq
+#
+BITRATE=$1
+DSTPORT=$2
+QUEUEDELAY=400000 #400ms
+
+GSTREAMER_VERSION="0"
+
+if [ "$DSTPORT" == "" ]
+then
+ echo "Usage:"
+ echo " $0 <url> <bitrate> <zmq destination port>"
+ exit 1
+fi
+
+
+if [ "$GSTREAMER_VERSION" == "1" ]
+then
+ gst-launch-1.0 -q \
+ alsasrc "device=default" ! \
+ audio/x-raw, 'rate=48000,format=S16LE,channels=2' ! \
+ queue "max-size-time=$QUEUEDELAY" ! \
+ filesink location="/dev/stdout" | \
+ ../fdk-aac-dabplus/aac-enc-dabplus-zmq \
+ -i /dev/stdin -b $BITRATE -f raw -a -o "tcp://*:${DSTPORT}"
+
+elif [ "$GSTREAMER_VERSION" == "0" ]
+then
+ gst-launch -q \
+ alsasrc "device=default" ! \
+ audio/x-raw-int, 'rate=48000,format=S16LE,channels=2' ! \
+ queue "max-size-time=$QUEUEDELAY" ! \
+ filesink location="/dev/stdout" | \
+ ../fdk-aac-dabplus/aac-enc-dabplus-zmq \
+ -i /dev/stdin -b $BITRATE -f raw -a -o "tcp://*:${DSTPORT}"
+fi
+