diff options
-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 + |