Kodi -> Video Encoder -> Custom Channels

I have been experimenting with using a Kodi device to connect to my Encoder :

https://www.amazon.com/dp/B07TKMPCZH

On the kodi device (I'm running Raspberry Pi 3B currently using LibreELEC) :

  1. Install Matt Huisman's HULU addon (yes, you need paid account):
  1. Install Matt Huisman's IPTV Merge (used to get epg/m3u8 data available):
  1. start Hulu addon and "login"

  2. Then start addon IPTV Merge and:

go to "Playlists" > "Add Playlist" , select "Add-on", Select "Hulu"

  1. In IPTV Merge setting, enable:

"General" > "HTTP API Server"

( This opens up a server on the device port 52104, where EPG and m3u8 can be accessed)

At this point, you have installed existing addons developed by Matt Huisman , and then one more piece is needed, a "middle man" addon that I am working on:

(you can download the zip at https://github.com/kcook98765/service.IPTVEncoderRedirect/archive/refs/heads/main.zip).

Currently it is hard coded ip addresses in the addon, but it is a small addon, and I will be adding settings to enable setup of custom ip addresses (like the encoder IP, port this addon runs on, etc).

Anyone should be able to play with this by editing the default.py file (only 89 lines long), to modify ip address and/or port.

This addon listens on (currently) port 9191 of the kodi device, and handles 3 types of requests:

  1. playlist.m3u8

This in turn calls the IPTV Merge http://localhost:52104/playlist.m3u8 url (enabled above in step 5)

This raw data though, has url's meant for internal kodi usage, so a simple substitution is made to instead call this addon, passing the original kodi link as a query parameter.

  1. epg.xml

This simply returns the IPTV Merge epg via http://localhost:52104/epg.xml

  1. play (this is intended to be called via the links modified in the playlist.m3u8 above)

This intercepts request for the channel, internally calls the kodi xbmc.executeJSONRPC on the kodi link (originally in IPTV Merge playlist.m3u8) which starts the video streaming.

It then sends a redirect to the requester to the Encoder IP using 0.ts

Anyway, this is a rough setup, but I have tested and it works, in Channels I set up a custom Channels:

http://192.168.2.9:9191/playlist.m3u8

http://192.168.2.9:9191/epg.xml

And it worked, populated the Channels EPG, and then I can play from channels (slight delay as you watch Kodi respond, then it starts the stream).

The neat thing is, you can tune the DRM channels ( as long as your Kodi can run the Widevine as noted in Matt Huisman's HULU addon, tested my local NBC and worked fine )

Also, Other streaming services can be added to kodi if they support IPTV Merge, and they should just work!)

I will be doing further work, setting up a settings area for the addon to manage Encoder url, port to run this addon on, etc.

Or maybe Matt might want to add such functionality himself to existing IPTV Merge :slight_smile:

3 Likes

One detail at this time, when Channels is done viewing/recording, Kodi won't know about it, and stream keeps playing.

I have some thoughts, one of which is to poll Channels DVR via API to see if anything is currently accessing the Video Encoder, and if not (after a delay to account for re-connects, etc), to auto close the stream in kodi itself. So while experimenting, remember to shut down stream manually in Kodi when done :slight_smile:

You can check ah4c to see how it works. It proxies the data and thus knows when the Channels side has disconnected and can clean up.

Thank, I will check it out, and maybe kodi is fine to do the proxy itself and thus know when disconnected. I will give this some thought and work up a solution.

1 Like

This is really dope

Was trying something like this with Matt’s Kayo sports add on.

Didn’t have anything to send the http request automatically at that stage and had issues with kodi crashing on any device I was using.

How have you gone with that side of things @kcshield ?

Ended up using a satellite box, a Hauppauge tuner and NPVR as a backend for my setup.

Cool to have this as another option.
Hopefully Matt keeps his addons updated though!

@kcshield Thanks, keen to this give a whirl. I'll try Kodi on my macOS machine using Matts Kayo add on as that's my primary objective. Let you know how it goes
@tree2369 IPTV merge is supported by Matts Kayo add on although he has been trying to resolve an unrelated issue with Kayo which I think he is making progress.

1 Like

@kor yeah I used to use it to combined his AU iptv streams with Kayo and Binge for a pseudo-Foxtel box - but felt like kodi would always crash on my shield - so moved to Kayo for channels..until they put drm on the streams.

Now I’m just on a HDMI for channels type setup with my Foxtel box.

Keep us updated how you find the reliability if you could! Wouldn’t mind moving back to Kayo/binge eventually :slight_smile:

I'm still working on this, looking into best way to shut down kodi "playing" when encoder is no longer serving a client, as well as more features, tracking multiple ports (though will only need one kodi to have addon, as others can be remote controlled as needed from the single one).

I will also be testing stability, but part of this comes down to the device(s) used to run Kodi, as well as Kodi version and and the specific Video Addon itself, and I only have accounts for Hulu currenlty, but since this feature should pick up any setup via IPTV Merge, other should be able to test.

I will make this available via my Kodi repository once I have a few more things worked out, to make it easier for others to install and test.

FYI, for many encoders like the one I use, this is very interesting information (and a reminder to keep such devices off the WAN!) :

Near the end, it mentions default passwords for Telnet to these boxes, and I can confirm I have Telnet access now to the Encoder (looking to see if there is a "Safe" way to use Telnet to ID which client(s) are currently using the encoder stream(s)).

1 Like

I now have Alpha version 0.0.100 available at :

I have gotten it to be fairly stable with just one encoder in use (next step I will be adding 3 more kodi devices to test running more than one stream).

the README at github explains how to install and setup, and there is a fair amount of forced logging (forced for now, will modify to use standard log levels after more testing/feedback).

I have it setup for ChannelsDVR and I will be testing some recordings.

Since it uses HULU (though any IPTV merge capable addon should work) for kodi and not TVE, you will be limited to # of concurrent streams if you setup more than 1, so I would limit to the DRM channles you can't get via TVE.

Please do let me know of any issues (prefer submit to my github, but will check here from time to time).

After I test multiple devices, I have plans to add functionality so that virtual channels could be added , via this addon, for example activate a directory for HULU (or other addon), whereby the VOD entries could be auto merged into the m3u8 along with fabricated EPG data on a random (or other) selection of programs available, in this way, you could record programs not available on the live channels, but instead via VOD using this addon :slight_smile:

2 Likes

ok finally have something to try this with since Kayo has bombed out!

if I install the headless version of Kodi, should that still work Kodi Headless Docker Container

I've been waiting for a fix for Hulu to test myself, so have not yet tried more testing. But this addon is very simple and very little code. I would think it should run fine in any kodi install, but let me know if you have any issues.

Once I have Hulu working on kodi, I will be testing it more vigorously by setting up recordings, etc.

I got Hulu working for Kodi (submitted PR, so not yet working for all). I can tune channels (including paid HBO via Hulu) and have setup multiple recordings to begin testing my Proxy for this project over the weekend.

I am testing via Kodi on a Firestick 4K , and tuning takes apx 30 seconds (so pad your recordings appropriately).

I will update next week with results.

It was a bit hit or miss, due to Fire TV Stick crashing the Kodi App. I did mange to get a couple recordings, so this addon itself seems to work well so far (and maybe other Services via Kodi with "IPTV Merge" capabilities would not be a crash issue.

I have modified my fix for Hulu on Kodi (waiting on any official merge to Matt's Addon), and it seems to have helped with Fire TV not crashing so far, so continuing to test for now with more scheduled recordings.

@matthuisman Is there anyway to create a bridge or proxy that allows for content from Kodi (such as Stremium or other content with Widevine) to be passed to Channels? Something where it is played via Kodi's player and captured into Channels either via chrome capture or M3U of sorts?

Thinking something like where the Kodi player becomes a tuner source for Channels to use, that way we can leverage many of the great add-ons for other services you created.

eeerm i have GitHub - matthuisman/kodi.proxy which allows tvheadend users etc to call my kodi addons and get a ffmpeg pipe back. it basically just stubs out all of kodis api so the addons can run.

it does not do any sort of video capture etc. so wont work with DRM or anything like that

Is there any way to pipe that out in a way that is compatible with Channels?

I'm trying to find a way to get content from Stremium (Philo) into Channels without all the hardware complexity

can you use streams from kodi and export them to m3u8