Rebroadcast internet or local streaming radio to FM with updated Artist and Song name in RDS text
(in this example
http://webradio.antennevorarlberg.at:80/lounge)
The scope of this How-To is to be able to extract song info and put it into the RT field of RDS in pseudo real time (10 seconds delay)
This is not an issue but a 'How-To', sorry but I didn't find anywhere to put this.
prerequisites
sudo apt-get install sox
sudo apt-get install lame
sudo apt-get install libsox-fmt-mp3
sudo apt-get install perl install ffmpeg (because we need the ffprobe command to do the job):
download and compile ffmpeg from the source.
https://www.ffmpeg.org/download.htmlthe current version is ffmpeg-4.0.2.tar.bz2
cd /root
wget https://ffmpeg.org/releases/ffmpeg-4.0.2.tar.bz2
tar -ffmpeg-4.0.2.tar.bz2
cd ffmpeg-4.0.2
./configure
make
sudo make installIMPORTANT NOTE: on Pi2 the above FFMPEG compile process takes several hours to be completed!! Be extremely patient. this is my script to do the dirty job:
sudo nano /root/inject-title.sh- Codice: Seleziona tutto
#!/bin/bash
# by pilovis - Italy - parknat12 at yahoo.com
cd /root
/bin/sleep 1
rm /tmp/rds_ctl
/bin/sleep 1
mkfifo /tmp/rds_ctl &
/bin/sleep 1
/usr/bin/sox --buffer 65536 --input-buffer 65536 -t mp3 http://webradio.antennevorarlberg.at:80/hits -t wav -c 2 - | sudo ./PiFmAdv/src/pi_fm_adv --preemph eu --ctl /tmp/rds_ctl --freq 88.0 --audio - &
while :
do
/usr/local/bin/ffprobe 2> /dev/null -show_format http://webradio.antennevorarlberg.at:80/hits | grep TAG:StreamTitle= | cut -d '=' -f 2 | /usr/bin/perl -ne 'print "PS 'RADIO-88'\nRT $_"' > /tmp/rds_ctl
/bin/sleep 10
done
note: I put rds_ctl file in /tmp (RAM tmpfs) to avoid wearing out the SD card.
give the right permissions to the above script:
sudo chmod 755 /root/inject-title.sh launch the script and it's done:
sudo /bin/sh /root/inject-title.sh ¬e: after a few seconds delay the FM radio should start transmitting on 88.0 Mhz with "RADIO-88" station name.
to stop the FM transmitter and all related processes, use the following command:
sudo killall pi_fm_advEnjoy