diff options
author | Matthias P. Braendli <matthias.braendli@mpb.li> | 2014-01-03 22:07:01 +0100 |
---|---|---|
committer | Matthias P. Braendli <matthias.braendli@mpb.li> | 2014-01-03 22:07:01 +0100 |
commit | dde8490b0b522fd5fd9ba9ec4438b20546281faf (patch) | |
tree | 48395ad18a10ad028a8eacc495e5cd9a6be8fd7a | |
parent | 80b324e915e972adee078ac1dc5cf1848de00eb7 (diff) | |
download | mmbtools-aux-dde8490b0b522fd5fd9ba9ec4438b20546281faf.tar.gz mmbtools-aux-dde8490b0b522fd5fd9ba9ec4438b20546281faf.tar.bz2 mmbtools-aux-dde8490b0b522fd5fd9ba9ec4438b20546281faf.zip |
add encode-alsasrc-gst-dabplus.sh
-rwxr-xr-x | encode-alsasrc-gst-dabplus.sh | 39 |
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 + |