aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNick Piggott <nick+work@piggott.eu>2015-08-24 11:40:38 +0100
committerNick Piggott <nick+work@piggott.eu>2015-08-24 11:40:38 +0100
commit358774ca2aaef07f8282a00ca672e6fc62068e3c (patch)
tree07c875f9f690206c50b2aba56f099c159221b29a
parentb07b735cc475636fa935dbb1ccadc13fea396a74 (diff)
downloaddab-scripts-358774ca2aaef07f8282a00ca672e6fc62068e3c.tar.gz
dab-scripts-358774ca2aaef07f8282a00ca672e6fc62068e3c.tar.bz2
dab-scripts-358774ca2aaef07f8282a00ca672e6fc62068e3c.zip
Read encoding options from command line
Updated to read in the options required for toolame or dabplus-enc from the command line, rather than relying on hard coded values. The options should be appended to each line in the configuration.sh file
-rwxr-xr-xencode-libvlc.sh17
-rw-r--r--examplesite/configuration.sh2
2 files changed, 14 insertions, 5 deletions
diff --git a/encode-libvlc.sh b/encode-libvlc.sh
index 8f8f672..361a743 100755
--- a/encode-libvlc.sh
+++ b/encode-libvlc.sh
@@ -29,13 +29,22 @@ URL=$1
ID=$2
DST=$3
-if [[ "$#" -eq 4 ]] ; then
+if [[ "$#" -gt 3 ]] ; then
ENC=$4
else
ENC="dabplus-enc"
fi
-BITRATE=80
+if [[ "$#" -gt 4 ]]; then
+ shift 4
+ OPTIONS=$@
+else
+ if [[ "$ENC" == "dabplus-enc" ]]; then
+ OPTIONS="-b 80 -r 32000"
+ else
+ OPTIONS="-b 128 -s 48 -L"
+ fi
+fi
running=1
@@ -64,10 +73,10 @@ do
printmsg "Launching encoder"
if [[ "$ENC" == "dabplus-enc" ]] ; then
- dabplus-enc -v "$URL" -b $BITRATE -r 32000 -o "$DST" -l &
+ dabplus-enc -v "$URL" $OPTIONS -o "$DST" -l &
encoderpid=$!
elif [[ "$ENC" == "toolame" ]] ; then
- toolame -V -s 48 -L -b $BITRATE "$URL" "$DST" &
+ toolame $OPTIONS -V "$URL" "$DST" &
encoderpid=$!
fi
printerr "Detected crash of encoder!"
diff --git a/examplesite/configuration.sh b/examplesite/configuration.sh
index 6ff72eb..a065697 100644
--- a/examplesite/configuration.sh
+++ b/examplesite/configuration.sh
@@ -13,5 +13,5 @@ declare -A radios
radios[radio1]="./encode-libvlc.sh http://fbpc5.epfl.ch:8000/fb_192 radio1 tcp://localhost:9001"
# Attenuate radio2 by 3dB
-radios[radio2]="./encode-libvlc.sh http://mp3lg.tdf-cdn.com/fip/all/fiphautdebit.mp3 radio2 tcp://localhost:9002 toolame"
+radios[radio2]="./encode-libvlc.sh http://mp3lg.tdf-cdn.com/fip/all/fiphautdebit.mp3 radio2 tcp://localhost:9002 toolame -b 128 -s 48 -m j -y 2 -L"