aboutsummaryrefslogtreecommitdiffstats
path: root/encode-url-gst-dabplus.sh
blob: d1e2ce7f781e3cddf8059b75f7fedeecc117d4eb (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
#!/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}"