aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xencode-fbplus.sh23
-rwxr-xr-xencode-url-gst-dabplus.sh26
2 files changed, 46 insertions, 3 deletions
diff --git a/encode-fbplus.sh b/encode-fbplus.sh
index 6741c44..f864a0a 100755
--- a/encode-fbplus.sh
+++ b/encode-fbplus.sh
@@ -2,6 +2,23 @@
#
# Encode Frequence Banane to ZMQ tcp://*:2720
#
-mpg123 -s http://fbpc5.epfl.ch:8000/fb_192 |\
- sox -t raw -r 44100 -e signed -b 16 -c 2 - -t raw - rate 48k |\
- ../fdk-aac-dabplus/aac-enc-dabplus-zmq -i /dev/stdin -b 96 -f raw -a -o 'tcp://*:2720'
+
+WITH_GSTREAMER=1
+URL=http://fbpc5.epfl.ch:8000/fb_192
+BITRATE=64
+
+if [ "$WITH_GSTREAMER" == "1" ]
+then
+ gst-launch-1.0 -q \
+ uridecodebin uri=$URL ! \
+ queue ! \
+ audioresample quality=8 ! \
+ audioconvert ! \
+ audio/x-raw, 'rate=48000,format=S16LE,channels=2' ! \
+ filesink location="/dev/stdout" | \
+ ../fdk-aac-dabplus/aac-enc-dabplus-zmq -i /dev/stdin -b $BITRATE -f raw -a -o 'tcp://*:2720'
+else
+ mpg123 -s $URL |\
+ sox -t raw -r 44100 -e signed -b 16 -c 2 - -t raw - rate 48k |\
+ ../fdk-aac-dabplus/aac-enc-dabplus-zmq -i /dev/stdin -b $BITRATE -f raw -a -o 'tcp://*:2720'
+fi
diff --git a/encode-url-gst-dabplus.sh b/encode-url-gst-dabplus.sh
new file mode 100755
index 0000000..d1e2ce7
--- /dev/null
+++ b/encode-url-gst-dabplus.sh
@@ -0,0 +1,26 @@
+#!/bin/bash
+#
+# Read a URL using gstreamer, and encode with fdk-aac-dabplus-zmq
+#
+URL=$1
+BITRATE=$2
+DSTPORT=$3
+QUEUEDELAY=400000 #400ms
+
+if [ "$DSTPORT" == "" ]
+then
+ echo "Usage:"
+ echo " $0 <url> <bitrate> <zmq destination port>"
+ exit 1
+fi
+
+
+gst-launch-1.0 -q \
+ uridecodebin uri=$URL ! \
+ queue "max-size-time=$QUEUEDELAY" ! \
+ audioresample quality=8 ! \
+ audioconvert ! \
+ audio/x-raw, 'rate=48000,format=S16LE,channels=2' ! \
+ filesink location="/dev/stdout" | \
+ ../fdk-aac-dabplus/aac-enc-dabplus-zmq \
+ -i /dev/stdin -b $BITRATE -f raw -a -o "tcp://*:${DSTPORT}"