IPTV input streams for Plex Media Server

Plex Media Server is an all-in-one media center solution that I have been a fan of for a long time. Since a few years liveTV is a set of features that have become part of the Plex ecosystem, that allows cord cutters to significantly up their waching experience with timeshift, automarking of commercials etc. Unfortunately the only way of getting a TV signal into Plex at the time of writing is by adding extra hardware to your setup. There is no support for direct IPTV input streams.

I tink it is time to acknowledge that getting a live TV stream into your household via Satelite, Cable or Antenna should be a thing of the past. We love ethernet!

I’ve tried – over years – to get this working and have always suffered major setbacks. Last year I have written a sumup of the situation in the Plex Forums. The topic got a lot of views very early but it didn’t lead me solve the issue.

Fortunately, I never don’t give up. So I tried again and again. …and I got it working eventually!

This tutorial will guide us step by step to get an M3U IPTV input stream into Plex Media Server keeping a special eye on all the pitfalls that I had gone through myself. I hope you find this useful. I’d love to hear your feedback in the comments section.

Requirements

I am assuming you have Plex up and running. In this document I am going to refer to an installation on Ubuntu 18.04 server via docker-compose. The guide will also apply for other installations. If you don’t know, what docker is, I would highly recommend to read about it here.

Sign up with an IPTV provider of your choice

This highly depends on where you are living and if you start from scratch and just google the term ‘iptv’ expect to get a lot of IPTV comparison sites that will only try to make you sign up for shady services. I can’t really give a recommendation here.

If you are looking for a good starting point, there is https://github.com/iptv-org/iptv which is a collection of free accessible IPTV channels sorted by country, genre and language. If you are signed up with an ISP that offers IPTV as additional service what you want to get is your m3u playlist file. It is usally encoded in this format: http://[ip_of_your_provider.com]/get.php?username=[username]&password=[password]&type=m3u_plus&output=ts

xTeVe – M3U Proxy for Plex DVR

As stated, Plex doesn’t directly support the IPTV input stream. Whats closest to IPTV (in Plex terms) is the signal created by a HD homerun. It is a network-attached digital television tuner box, produced by the company SiliconDust. It receives a live TV signal and then streams the decoded video over a local area network to an existing device.

We’re going to install xTeVe which will identify to Plex as a HD Homerun. With the right configuration over its neat webGui we’ll convince Plex to then use this input stream.

xTeVe via docker-compose

I found that dnsforge/xteve is the best supported docker implementation for xTeVe and – at least according to the repository – it is also the officially recommended one from xTeVe. There is a discord channel where I found answers to some very crucial questions. I really recommend that you go there for specific questions about xTeVe

Here is my docker-compose

# xTeve - IPTV proxy for Plex
  xteve:
    image: dnsforge/xteve
    container_name: xteve
    hostname: xteve
    restart: unless-stopped
    ports:
      - "34400:34400"
    environment:
      - TZ=${TZ}
      - PUID=${PUID}
      - PGID=${PGID}
      - XTEVE_PORT=34400
      - XTEVE_BRANCH=master
      - XTEVE_TEMP=/buffer
    volumes:
      - ${USERDIR}/docker/xteve:/home/xteve/conf
     - /dev/shm:/buffer

The variables ${PUID} ${PGID} ${TZ} and ${USERDIR} are all defined in /etc/environment as mentionned in the smarthomebeginner guide.

The configuration wizard

Navigate to http://hostname:34400/web/ to access the WebGui.

Here we set the amount of concurrent streams our IPTV provider allows us to use. More streams means more recordings at the same time.

Now we chose the source of our EPG (electronic program guide). The EPG data provided by Plex are really great content wise, but the channel mapping is entirely broken and no fun to use. We select XEPG here.

This is the actual channel file that contains the streams. If we are using the free IPTV streams from the github repo I posted above, we could for example use this stream: https://iptv-org.github.io/iptv/categories/news.m3u

If we got a password encoded stream from our ISP or IPTV provider it will be formatted like this: http://[ip_of_your_provider.com]/get.php?username=[username]&password=[password]&type=m3u_plus&output=ts

Now lets configure the source of the EPG data. Some providers do provide EPG data, while missing to mention that anywhere. In that case it is always worth a shot, to replace the get.php with xmltv.php and remove all information about the output stream type.

At this point we could already test the input stream in Plex, but we need to make a few adjustments first.

Buffer on a ramdisk

We click on settings and check the path of the ‘location for the temporary files. This will be a folder where all temporary buffer files for liveTV and recordings will be written into before they are moved anywhere else. The buffer is only 1MB of size, so the size of the location does not matter, but the type of storage does. Make sure this is a fast SSD at least. In our case we did even better and mounted /dev/shm which is a ramdisk in the volumes section as our /buffer folder and we defined it with the XTEVE_TEMP environment setting. So we just want to make sure this matches and set the folder /buffer/ here.

As for the type of streaming buffer we need to set it to ffmpeg.

Channel filters

Plex ‘only’ supports a maximum of 480 Channels. For me this is not a dealbreaker at all, but – among others – I wonder what the reason is and wether this limitation will ever be removed. If your IPTV provider is giving you more than you can handle, the filter section is where you can get ahead of things. The section is self explanatory. When a filter is applied, the amount of total channels in the above section XEPG Channels will reduce. Let’s for example filter all US:news channels with UltraHD, FullHD and HD content:

Channel Mappings

This one is important, and only after I found out about it was I able to use xTeVe for recordings in Plex. We had selected the EPG source to be taken from the IPTVs XMLTV source. That’s why we see the option to map channels here. Like mentionned above, if we try to map the channels in Plex we are only going to waste lifetime. If channels and EPG comes from the same provider, the mapping should be perfect. However Plex won’t be able to recognize reoccuring series which makes programming of recordings unusuable. To avoid this we bulk edit the entire lot and set “series” in the EPG category:

After this is done the xTeVe configuration is complete and we can move on to the IPTV settings in Plex.

Setup IPTV in Plex

We go to LiveTV & DVR settings in Plex and click on add device. A new window will open up. If the xTeVe device is not recognized automatically then enter http://[ip]:34400 and click connect. The device should be visible then

Click continue. A first glimpse of the channel overview is visible here. We wont change anything here and will just continue.

In the next window we are going to click the orange text that says ‘Have an XMLTV?‘ This will change the dialog window so we can enter the url of the XMLTV file.

The location of which we are getting from the xTeVe webgui in the top frame where it says XEPG url

We continue to finally check the channel mapping again. Fortunately we don’t need to change anything here as the EPG that comes from the same source as the channel m3u aligns perfectly. If we did though, we would have to manually select a non-searchable channel from the drop down menu and make sure not to double assign any or otherwise start from scratch with the entire channel mapping – bummer.

Plex now grabs the EPG info from the given source in xTeVe which shouldn’t take very long

This is it! After thats done, we can access the EPG and watch liveTV or record anything. It makes sense to add an extra liveTV folder in the library for recordings.

Done!