The comment by Argus Nymus on my Media Center for German IPTV post made it clear that my approach with playlist filtering via web proxy was way too overengineered. For several reasons I needed to rebuild my media center anyhow, so it was time to simplify my approch, which I describe in some detail here.
To skip my blah blah on Le Potato, you may go directly to
- Setting up tvheadend with German IPTV (the simple way)
- Using IPTV mixed with DVB-T2 (including how to set up DVB-T2 channels)
- Using HbbTV services’ EPG
Le Potato – State Of Affairs March 2019
A bit more than one year after Le Potato hit the market there is still no feature-complete open source mainline kernel available. The progress on it is considerable (see downloads section on the product page), and not too much is missing, but especially the multimedia features, which of course are crucial for a media center, are still incomplete. For this reason, the two Kodi projects that officially support Le Potato, namely LibreElec and CoreElec, still use the old 3.14 kernel by amlogic, containing some closed source, and which – according to the open source developers – is crappily done. I regularly try out new incarnations of the two projects. CoreElec is definitely the one that better supports Le Potato, while LibreElec still has a few bugs.
Honestly, I would not worry too much about the old, closed source kernel – I do not really care. But I got myself a Hauppauge WinTV dualHD USB TV receiver, and suddenly the kernel was no longer to be ignored. The receiver on first glance seems to work with the old kernel when using the CrazyCat TBS driver package, but it’s just not good enough. Using one tuner, it’s OK, but every few minutes there is a frame dropped, and that’s already more annoying I’d have thought. As soon as tuner #2 comes into play, things get unbearable. That dramatically changes as soon as you use kernel 4.11 and above: The device is natively supported and works rock solid on both tuners (N.b.: LinuxTV claims full support available only with kernel 4.17 and above).
After the desaster with my Smart TV I needed a working TV better sooner than later, and so my current solution is to have a Raspberry Pi with kernel 4.19 running in parallel with Le Potato. The Raspberry Pi now has the tvheadend server role, but has no H.265 capable GPU, which is why Le Potato remains my media center device, playing the HEVC content pulled from the Raspberry. This only requires the tvheadend PVR frontend on Le Potato to be configured to point to the Raspberry Pi as tvheadend server. That works very nice and stable, but I still cannot wait to have the new kernel on Le Potato: I hate to waste another 5 W of energy with the otherwise unneeded Raspberry.
As a closing remark here: You can very well see how much the community is at least of equal importance for a SBC as the features it offers in itself. Raspberry Pi falls back in feature set more and more, but OS and software wise, it outclasses the Le Potato by far.
Recap: The 30 Minutes Problem
As in my previous setup, the goal is to use the live streams that the public service TV stations provide via the Akamai network. The tricky part is that the streams are set up by the TV providers to cover 30 minutes of stream, which is to allow skipping backward via their web interface. Using the playlists unaltered would lead to a not-so-live TV experience lagging behind half an hour. Argus Nymus pointed me to the GET parameter “dw” that you may add to the Akamai URLs, which allows you to set the time span covered by the stream in seconds – and that does the trick! Thanks again Argus Nymus! So lets…
Configure tvheadend For IPTV
I’ll skip any basic setup stuff regarding installing tvheadend – this is covered extensively by many tutorials on the web. So I assume that you’ve successfully set up and configured the tvheadend base.
The general concept of tvheadend is: You have a channel, to which one or more services are mapped, which are derived from muxes (short for “multiplexers”) that are part of (broadcasting) networks. So in the following I create an IPTV network, build the muxes from the live TV playlists, which automatically results in the creation of services, which I map to channels then. All is done by using the tvheadend web interface accessible via http://<your device IP or name>:9981.
Create IPTV Network
The German IPTV playlists work with an “IPTV automatic network”, which you may name as you like:
Create Muxes From IPTV Playlists
The playlists for the German public TV are available from many sources – one very good is this one (search for “!<Your TV station> #Livestream” – thanks again Argus Nymus!). The URLs look like this:
If you download them and view them in a text editor, you get something like this:
I am only interested in the two highest resolution streams, which I highlighted in the list above. For those two URLs I create a mux each:
Now in the URL-field you paste the desired URL from the m3u8 playlist above, and add &dw=XX to it at the end, where XX is the number of seconds you’d like to have the stream to cover. 20 sec is enough for me, having the TV as live as possible (of course, IPTV is always a bit behind anyhow, but we’re talking about less than a minute here).
After hitting “+ Create” the mux will be created, and within the next few seconds tvheadend will scan it. If everything was done right, a new service will be created.
Make sure that you name the muxes for the same TV stations in the same way – you’ll see why in the next step.
Alternatively, you could directly paste the m3u8 URL from the top of this step, add the &dw=XX there. You’d then get a service for each playlist entry – the task then would be to pick only the desired services. Using the GET parameter b you could filter by bitrate, which may save you the trouble, but having the stability issues from my first approach in mind, I did not bother. In case you try it, please leave a comment below!
The service now needs to be mapped to a channel. I’d do this step only after I have created all muxes, since the mapping procedure can digest many services at once (just select all of them before clicking “Map selected services” – see below) and will create the channels according to the mux names. Hence the recommendation to pick the same mux names for the same TV stations.
Select the “Merge same name” tick mark. tvheadend will then create new channels as needed.
And that’s it basically. The channels can now be consumed by the tvheadend PVR frontend in Kodi.
My DVB-T2 device has two tuners, so I can record and watch independent channels simultaneously. Still, I’ve had situations where I recorded two channels, and still wanted to watch TV. Fortunately, you can mix different services into one channel, and assigning priorities, you can define which source to try first, and have others as fallback. So below I configure tvheadend to first try DVB-T2, and then IPTV for any channel available from both sources.
There are many DVB-T2 tutorials, but following them by the letter didn’t work out for me, because they omit one step necessary at least with my WinTV receiver. So here are all steps I did:
The following step must be done for any DVB-T2 tuner you have in the list on the left:
The next step is the one missing in all tutorials I checked on the web. I needed to change the delivery system to DVB-T2, since it is set to the “old” DVB-T by default:
Now you need a bit of patience while tvheadend scans all frequencies. You now should see services turning up, and from here it’s like in the IPTV-section: select the services and map them to channels.
Mixing IPTV And DVB-T2
Assign Higher Priority To DVB-T2 Sources
To have DVB-T2 to be the service first used, and IPTV only as fallback, the priority of the DVB-T2 services must be higher than that of the IPTV services. To achieve this, select all used DVB-T2 services (in the screenshot you’ll see assigned priorities already – ignore; default is 0):
I chose priority 2 for no particular reason – it just needs to be higher than that of the IPTV services, which default to 0.
Map IPTV Services To DVB-T2 Channels
In order to have the IPTV as fallback for a given channel, select all matching IPTV services and select edit:
Do not forget to set the tick mark in front of the channel field.
I’d recommend to map the IPTV services to the DVB-T2 channels rather than vice versa. This ensures that the channel name matches the over the air EPG grabber associated with the DVB-T2 station. Of course you can configure EPG manually later, but why bother?
And that’s it basically. tvheadend now will try DVB-T2 first whenever you tune to a given channel, and will use IPTV if all DVB-T2 tuners are already booked.
Currently Kodi does not support HbbTV, the relatively new hybrid TV standard. I understand that tvheadend does, but Kodi has no plugin I know of that consumes the data provided. Reading in the forums it even seems that the current Kodi developers are kind of opposed to adopting this standard, which is a pity IMHO. Until it broke down, my smart TV provided HbbTV to me, and I find the added value useful. Main roadblock seems to be that you need a web browser/http rendering client, and that does not yet exist for Kodi, although often asked for.
Anyhow, at least in Germany among the HbbTV signals are a few TV stations that are not aired directly, but as HbbTV-“link” to an IPTV stream. While I cannot consume them directly in Kodi, there still comes along some EPG information (as it seems only the current and the upcoming show). And since I have not found a legal EPG source on the internet yet and do not want to use the dodgy ones, I want to add the EPG information from HbbTV to the IPTV channels wherever there’s a match.
To achieve this, I used the exact same approach as above, with the only exception that this time I assign a priority of -10 to the DVB-T2 signal, making IPTV the default. Keep in mind that the channel name should match the DVB-T2 HbbTV channel name if you do not want to manually configure EPG mappings.
Since only the current and next TV show comes with the HbbTV EPG, I changed the over-the-air EPG grabber schedule to run every hour instead of twice a day as the default would be:
Btw.: If you know of a legal source for tvheadend EPGs for German TV, or you know a working HbbTV implementation for Kodi, please write a comment below!
Update: I’ve created my own legal EPG scraper for some German TV