aboutsummaryrefslogtreecommitdiffstats
path: root/encode-fbplus.sh
blob: cc0d32edcacada52afff9d6fc558ec5f7a617521 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/bin/bash
#
# Encode Frequence Banane to ZMQ
#
# Remarks: it's probably better to use the
# snd-aloop scenario now.

WITH_GSTREAMER=0
URL=http://fbpc5.epfl.ch:8000/fb_192
BITRATE=$1
DSTPORT=$2

if [ "$DSTPORT" == "" ]
then
    echo "Usage:"
    echo " $0 <bitrate> <zmq destination>"
    exit 1
fi

if [ "$WITH_GSTREAMER" == "1" ]
then
    gst-launch-0.10 -q \
        uridecodebin uri=$URL ! \
        queue ! \
        audioresample quality=8 ! \
        audioconvert ! \
        audio/x-raw-int, 'rate=48000,format=S16LE,channels=2' ! \
        filesink location="/dev/stdout" | \
        dabplus-enc-file-zmq \
            -i /dev/stdin -b $BITRATE -f raw -a -o $DSTPORT
else
    mpg123 -s $URL |\
        sox -t raw -r 44100 -e signed -b 16 -c 2 -   -t raw  - rate 32k |\
        dabplus-enc-file-zmq \
            -i /dev/stdin -r 32000 -b $BITRATE -f raw -a -o $DSTPORT
fi