User Tools

Site Tools


tricks:tvheadend_internet_radio

TVHeadend Internet/Shoutcast/Icecast Radio

Before you read further, this does NOT create a directory index for you like TuneIn and such. This is only if you have the direct URL's to your favorite radio stations :)

Step 1, check your ffmpeg version, if it tells something about avconv, your version is crap <rant>and I don't even know what the f.. they were thinking when splitting it up.. wth….</rant>
Step 2, Compile or download a pre-compiled(“static”) version of ffmpeg, put it in /home/hts/ or somewhere you want. (/home/hts/.hts/here?)
Step 3, Add a new “IPTV Network” network. (Configuration → DVB Inputs → Networks) The name doesn't matter, so call it “Internet Streams” or something..
Step 4, (repeat this step for each radio):
Go to the “Muxes” tab. Press “Add”, select the network from step 3.
Put this in the “URL:” field:

pipe:///home/hts/ffmpeg -loglevel fatal -i http://whatever/fancyradio -vn -acodec copy -metadata service_provider=RadioProvider -metadata service_name=RadioName -f mpegts -mpegts_service_type digital_radio pipe:1

(remember to edit the “http://whatever/fancyradio”, “RadioProvider” and “RadioName” to your correct values! These are what will be shown in Kodi etc.)
And so you can quickly find it in the future, you should probably name the mux the radio name.
Step 5, Map services to channels

I used the “release” build 3.2.4 from https://johnvansickle.com/ffmpeg/ - As the “hts” user I did the following:

wget https://johnvansickle.com/ffmpeg/releases/ffmpeg-release-64bit-static.tar.xz
tar xvfJ ffmpeg-release-64bit-static.tar.xz
cp ffmpeg-3.2.4-64bit-static/ffmpeg .
rm ffmpeg-* -r

Here's the permissions on my system:
-rwxr-xr-x 1 hts hts 44M Feb 20 02:53 /home/hts/ffmpeg

And that is how you get an shoutcast, icecast or whatever else stream working on TVHeadend. Enjoy. Also, sorry for not making a better guide if you came here from google, this is just my notepad.

In case “IT JUST DOESNT WORK! AND ITS ALL YOUR FAULT!”, run the following (replaced with your values of course..) as the user that tvheadends runs as (important).

/home/hts/ffmpeg -i http://whatever/fancyradio -vn -acodec copy -metadata service_provider=RadioProvider -metadata service_name=RadioName -f mpegts -mpegts_service_type digital_radio testOutput.ts

It should let you know if there's any errors, and what the errors are. If there's none, and it keep running. Try stopping it with ctrl+c, and play the testOutput.ts in VLC or whatever. If the .ts file plays fine, ffmpeg is not the problem. Try looking if the tvheadend has access to executing the ffmpeg.

<rant>
The ffmpeg/avconv in the debian wheezy and jessie is at the time of writing (Feb/2017) just terrible as f***. Either they are taking a minute to figure out they don't understand the mpegts arguments. Or they are just so slow (no, it's not a slow machine), that your radio stream ends up getting a few minutes behind. I have no idea what they are during with those editions. There's no problems on other distros or when using the static builds (or compiling it yourself).</rant>

pipe:///home/hts/ffmpeg -loglevel fatal -i http://live-icy.gss.dr.dk/A/A05H.mp3 -vn -acodec copy -metadata service_provider=DR -metadata service_name=DR\ P3 -f mpegts -mpegts_service_type digital_radio pipe:1
pipe:///home/hts/ffmpeg -loglevel fatal -i http://netradio.skala.fm/esbjerg -vn -acodec copy -metadata service_provider=skala.fm -metadata service_name=skala.fm -f mpegts -mpegts_service_type digital_radio pipe:1
pipe:///home/hts/ffmpeg -loglevel fatal -i http://stream.wlmm.dk:8000/victoria -vn -acodec copy -metadata service_provider=Radio\ Victoria -metadata service_name=Radio\ Victoria -f mpegts -mpegts_service_type digital_radio pipe:1
pipe:///home/hts/ffmpeg -loglevel fatal -i http://bbcmedia.ic.llnwd.net/stream/bbcmedia_radio1xtra_mf_p -vn -acodec copy -metadata service_provider=BBC -metadata service_name=BBC\ Radio\ 1Xtra -f mpegts -mpegts_service_type digital_radio pipe:1

ps. there's more cool options available, see https://www.ffmpeg.org/ffmpeg-formats.html#mpegts-1

tricks/tvheadend_internet_radio.txt · Last modified: 2017/03/19 03:34 by mathias