News:

Latest versions:
Server plugin: 0.5.1
MVP dongle: 0.5.2
Raspberry Pi client: 0.5.2
Windows client: 0.5.2-1

Main Menu

[Solved] How to stream internet radio to a MediaMVP?

Started by ekluba, December 13, 2009, 14:59:10

Previous topic - Next topic

ekluba

Hi All.

Right now I am trying to play internet radio over MediaMVPs running vomp. (TV works for years now.) I have spent some hours searching and tried vdr-plugin-mp3 but this seems to work only with full featured cards. (I have a budget system and no reason so far to "upgrade" it.)
AFAIK the only chance to play internet radio with MVPs are patches developed by AVVDR and/or Andreas Vogel. But a patched vdr installation is harder to maintain...

Any ideas?

TIA
ekluba.  





rdoac

I use a combination of vdr-iptv, mplayer and ffmpeg..

Install them all and then create a channels.conf for the station of choice:

101QFL-InternetStream;IPTV:190:IPTV|S0P0|EXT|qflradio.sh|8:P:0:0:256:0:0:11:0:0:0
:->UK Radio
:@251
BBCRadio1;IPTV:110:IPTV|S0P0|EXT|bbcradio.sh|1:P:0:0:256:0:0:11:0:0:0
BBCRadio2;IPTV:120:IPTV|S0P0|EXT|bbcradio.sh|2:P:0:0:256:0:0:12:0:0:0
BBCRadio3;IPTV:130:IPTV|S0P0|EXT|bbcradio.sh|3:P:0:0:256:0:0:13:0:0:0
BBCRadio4;IPTV:140:IPTV|S0P0|EXT|bbcradio.sh|4:P:0:0:256:0:0:14:0:0:0
BBCRadio5;IPTV:150:IPTV|S0P0|EXT|bbcradio.sh|5:P:0:0:256:0:0:15:0:0:0
BBCRadio5Live;IPTV:160:IPTV|S0P0|EXT|bbcradio.sh|55:P:0:0:256:0:0:16:0:0:0
BBCRadio6;IPTV:170:IPTV|S0P0|EXT|bbcradio.sh|6:P:0:0:256:0:0:17:0:0:0
BBCRadio7;IPTV:180:IPTV|S0P0|EXT|bbcradio.sh|7:P:0:0:256:0:0:18:0:0:0


That calls a script called bbcradio.sh via iptv, which is:

#!/bin/sh

# internetradio.sh is used by the VDR iptv plugin to transcode an internet
# radio stream.
#
# The script originates from:
# http://www.vdr-wiki.de/wiki/index.php/Iptv-plugin
#
# An example channels.conf entry:
# internetradio;IPTV:2:IPTV|S0P0|EXT|internetradio.sh|0:P:0:0:256:0:0:2:0:0:0
#
# internetradio.sh is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This package is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this package; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
# MA 02110-1301, USA.
#

if [ $# -ne 2 ]; then
    logger "$0: error: Invalid parameter count '$#' $*"
    exit 1
fi
#killall -9 ffmpeg
# Channels.conf parameter
PARAMETER=${1}

# Iptv plugin listens this port
PORT=${2}
mplayeropts="-playlist"
BITRATE=192

# Stream configuration

case ${PARAMETER} in
    1)
         URL="http://www.bbc.co.uk/radio/listen/live/r1.asx"
TITLE="BBC Radio 1"

         # Stream temporary files
         FIFO=/tmp/internetradio${PARAMETER}.fifo
        ;;
    2)
         URL="http://www.bbc.co.uk/radio/listen/live/r2.asx"
         TITLE="BBC Radio 2"

         # Stream temporary files
         FIFO=/tmp/internetradio${PARAMETER}.fifo
        ;;
    3)
         URL="http://www.bbc.co.uk/radio/listen/live/r3.asx"
         TITLE="BBC Radio 3"

         # Stream temporary files
         FIFO=/tmp/internetradio${PARAMETER}.fifo
        ;;

    4)
         URL="http://www.bbc.co.uk/radio/listen/live/r4.asx"
         TITLE="BBC Radio 4"

         # Stream temporary files
         FIFO=/tmp/internetradio${PARAMETER}.fifo
        ;;
    5)
         URL="http://www.bbc.co.uk/radio/listen/live/r5.asx"
         TITLE="BBC Radio 5"

         # Stream temporary files
         FIFO=/tmp/internetradio${PARAMETER}.fifo
        ;;
    55)
         URL="http://www.bbc.co.uk/radio/listen/live/r5l.asx"
         TITLE="BBC Radio 5 Live"

         # Stream temporary files
         FIFO=/tmp/internetradio${PARAMETER}.fifo
        ;;
    6)
         URL="http://www.bbc.co.uk/radio/listen/live/r6.asx"
         TITLE="BBC Radio 6"

         # Stream temporary files
         FIFO=/tmp/internetradio${PARAMETER}.fifo
        ;;
    7)
         URL="http://www.bbc.co.uk/radio/listen/live/r7.asx"
         TITLE="BBC Radio 7"

         # Stream temporary files
         FIFO=/tmp/internetradio${PARAMETER}.fifo
        ;;
    8)
         URL="mms://207.234.146.58/QFLtest"
mplayeropts=
         TITLE="101 QFL"
BITRATE="96"
         # Stream temporary files
         FIFO=/tmp/internetradio${PARAMETER}.fifo
        ;;

    *)
         URL="http://www.bbc.co.uk/radio/listen/live/r4.asx"
         TITLE="BBC Radio 4"

         # Stream temporary files
         FIFO=/tmp/internetradio${PARAMETER}.fifo
        ;;


esac
LOG=/tmp/ipstream

{
rm -f "${FIFO}"
mkfifo "${FIFO}"

if [ ${PARAMETER} = "8" ]; then
rm -f "${FIFO}"
echo Removed Fifo
fi

echo "$1 $2 mplayer $mplayeropts -dumpstream ${URL} \
  -nolirc -noautosub -noconsolecontrols -novideo -nojoystick \
  -dumpfile $FIFO > /tmp/mplayer.out
" >>$LOG
mplayer -dumpstream $mplayeropts "${URL}" \
  -nolirc -noautosub -noconsolecontrols -novideo -nojoystick \
  -dumpfile "$FIFO" &

# Time to connect and fill pipe
sleep 3
MYPID=$$
MPID=`pidof mplayer`

# Build audio only stream
# PID 0x100/256 = Audio

echo "ffmpeg -v -1 \
  -i "${FIFO}" -debug 1\
  -f mpegts -acodec mp2 -ac 2 -ab ${BITRATE}k -ar 44100 \
  udp://127.0.0.1:${PORT}?pkt_size=16356 2> /tmp/lame.out"

ffmpeg -v -1 \
  -i "${FIFO}" -debug 1\
  -f mpegts -acodec mp2 -ac 2 -ab ${BITRATE}k -ar 44100 \
  "udp://127.0.0.1:${PORT}?pkt_size=16356" &

FPID=${!}
echo $FPID >/tmp/iptv-$MYPID
echo $MPID >>/tmp/iptv-$MYPID

trap 'echo Trap activated; kill -9 ${FPID} 2>> $LOG ' INT EXIT QUIT TERM
/etc/vdr/plugins/iptv/procchk ${MYPID} &

# Waiting for the given PID to terminate
wait ${PID}
} >> ${LOG} 2>&1


Horribly messy, but it works, as the mediaplayer times out before the stream comes online..

ekluba

Hi rdoac.

Thanks. Never seen this before. Good to know it is possible to put it to work without a patch.

Most of what this solution does is understandable from the script. As far as I can see mplayer and ffmpeg do some conversion. From asx files to MVP compatibel format. My favourite channel here offers flash, wmp, ogg and mp3/m3u. But hopefully this is even easier to transform if not directly usable. But for know I'd be interested to know what vdr-iptv is used for? Does it provide OSD channel selection? Or MVP Radio or Media channel selection? Having no OSD on my budget vdr only the latter would be usable for me.

ekluba.

rdoac

vdr-iptv is a plugin for vdr which converts an iptv stream into something vdr can handle as any other channel.  It has several modes, the most useful being able to call a script.  The script is responsible for getting the stream back to the vdr server as a udp packet stream. 

I use it to stream shows from bbc iplayer as I now live in the US. 

ekluba

Hi all.

My MVP now streams internet radio simply using VOMP. No patches etc. so far.

The search for this feature once more showed how poor VOMP is documented. There are only few examples on the net and you have to find out that VOMP knows directories and commands to be able find to find a few brief descriptions on how this works. Chris once thought of a wiki. Good idea. Please start it. I would like to contribute. At least with providing empty links pointing to topics I need to know more about.

But now back to streaming internet radio with vomp:

According to the net all you have to do is add a [Media] section to vomp.conf


This is how the distributed vomp.conf ends:

## Base directory for TFTP server
## If you leave this blank the plugin config
## path will be used - i.e. where this file is

TFTP directory = /usr/share/vdr-plugin-vompserver
#---------------------------------------------------------------------

This is what you may add:

[Media]
#
Dir.1=/mnt/nas/audio
Dir.Name.1=AUDIO
#
Command.Extension.8=dir
Command.Type.8=LIST
Command.Name.8=/usr/local/bin/test1.sh
#
Command.Type.10=AUDIO
Command.Name.10=/usr/local/bin/test1.sh
Command.Extension.10=http-audio
#


The channels are described in directory /mnt/nas/audio
For testing I have added one channel: Deutschlandfunk;/http://dradio-mp3.t-bn.de/dlf128k_live.http-audio
to file radio.dir:

<myserver>:/mnt/nas/audio# cat radio.dir
Deutschlandfunk;/http://dradio-mp3.t-bn.de/dlf128k_live.http-audio
<myserver>:/mnt/nas/audio#

This works. VOMP know presents "radio.dir" and it's contents for selection and my audio equipment now produces enough output to clearly identify "Deutschlandfunk". The quality is very low indeed. I hope to find out how to improve it. Again without using patches.

Any ideas on how to produce crystal clear sound quality?

TIA
ekluba.

ekluba

Hi all.

Some tests regarding the sound quality issue had the following results:

- mp3 files worked perfectly
- mp3 streams worked without any quality at all
- using a FIFO to buffer the stream didn't make any difference
- copying a short mp3 file to the FIFO before reading the stream to this FIFO with wget does the trick.

Great. A small buffer with mp3 sound. (How small? We will see.)

To turn this into a nice feature a script may read the name of the station to the FIFO: "You are now listening to <Name of Radiostation>." Could be enough material. Or may be we have to add "on vomp version ...."

Thanks to all of you. Computing and radio are much more compatibel than computing & tv.

Have fun
ekluba.

ekluba

Hi all.

A recent test1.sh from wellenvogel solved the problem: http://www.wellenvogel.de/software/vomp/test1.sh

Thanks yo very much Andreas. Great work.

ekluba.