# Plex MythTV LiveTV Channel/Plugin

**URL:** <https://forums.plex.tv/t/plex-mythtv-livetv-channel-plugin/183505>\
**Category:** Dev/API Corner\
**Tags:** other-dev\
**Created:** [March 9, 2017, 2:01am UTC](https://forums.plex.tv/t/plex-mythtv-livetv-channel-plugin/183505 "2017-03-09T02:01:26Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![unsober](https://avatars.discourse-cdn.com/v4/letter/u/2bfe46/32.png) [@unsober](https://forums.plex.tv/u/unsober)\
**Post date:** [March 9, 2017, 2:01am UTC](https://forums.plex.tv/t/plex-mythtv-livetv-channel-plugin/183505/1 "2017-03-09T02:01:26Z")

</div>

I just purchased plexpass and was hoping to be able to do the livetv from myth, but there really weren’t any good options out there. I wrote a channel to do it. As of now, it just does the LiveTV. It doesn’t list the recordings. With some tweaking, I set up a plex libraries to look at the mythtv recordings folder - so i didnt have a need for recordings yet. I’m not a fantastic developer, It’s a little dirty and could probably be all done completely within the bundle, instead of the myth side php i used. My setup is ubuntu and separate VMs for plex and myth. HDHomeRun Prime. I have not done any load testing so don’t know what the CPU/mem requirements are, but i’ve been able to do 2 streams on multiple vcpu VMs without any issue.

I have a basic Channel/Plugin built, which does the initial communicating with Myth to get the channels/icons and then calls the php file on the mythserver to initiate the livetv and start streaming through plex. Keep in mind, this is not using the myth streaming/transcoding like I’ve seen a few people try to do - The Plexserver is accessing the raw video stream just like any standard client does (ie: mythfrontend/kodi) and then based on the plexclient, the plexserver does the transcoding. I didnt think it made sense to transcode once with myth and then another time with plex.

Ya place the bundle in the plugin directory obviously (may have to change permissions to the plex user) and there’s a config option when you launch the channel to set the mythtv hostname and/or ip and the categories you want to display. It always displays the “All Channels” and “Channels Recently Watched” category, but you can add things like Sitcom, Movie, anything ya like. It will create a group and only return those listings that have categories which fall within the group

The stream.php file (txt file attached) gets put in the web server root directory (ubuntu:/var/www/html) of the myth server as stream.php. Would need mythweb running of course.

It’s not perfect and I see plenty of room for improvement. I don’t have much down time, so I don’t know if I’m going to be able to get this further than it is, but if someone who is a little smarter than me wants to take it and run with it…it’s all yours. I haven’t done a huge amount of testing, but It does what i needed it to do both from a pc and my iphone.

Couple things I noticed…  
Rewinding and Fast-forwarding is funky. On the phone it works semi well, the web-browser, not so much. I think i have a way to account for it, just didn’t have time to do it yet.  
Channel Icons are sized weird, but better than nothing  
In my environment - for the most part, all the channels are always there. But, for some reason a few disappear. If you go back to the list a minute later - the missing ones show up. They’re randomly missing from results from the MythAPI call, so I’ll be looking into why Myth is fumbling the results to see if there is a better way to do it.

If I do end up making any updates, i’ll post them

Channel

 ![](https://sea1.discourse-cdn.com/plex/uploads/default/original/3X/d/b/db33d412b989d2988178eedf98f64966b3483bb3.png)

Options

 ![](https://sea1.discourse-cdn.com/plex/uploads/default/original/3X/7/b/7b77f23b41a0030f204f44d2bcac74e1fdc1a04f.png)

Categories

 ![](https://sea1.discourse-cdn.com/plex/uploads/default/original/3X/d/0/d0a18c8e82b2ac6175a0d409f5e2339a6ba52041.png)

Category Listings

Listing Details

MythTV Live Channel playback

---

<div class="post-metadata">

**Author:** ![c00l8thome](https://avatars.discourse-cdn.com/v4/letter/c/f17d59/32.png) [@c00l8thome](https://forums.plex.tv/u/c00l8thome)\
**Post date:** [March 12, 2017, 1:59am UTC](https://forums.plex.tv/t/plex-mythtv-livetv-channel-plugin/183505/2 "2017-03-12T01:59:06Z")

</div>

Unable to see the channel:  
I just copied the unziped “bundle” in the plug-ins directory changed the permission and ownerships and copied the stream.php in the webserver directory. I also disabled the compatibility check on the plex server side. Long story short I am unable to see the channel.  
Any thoughts? Thank you

---

<div class="post-metadata">

**Author:** ![unsober](https://avatars.discourse-cdn.com/v4/letter/u/2bfe46/32.png) [@unsober](https://forums.plex.tv/u/unsober)\
**Post date:** [March 12, 2017, 6:21am UTC](https://forums.plex.tv/t/plex-mythtv-livetv-channel-plugin/183505/3 "2017-03-12T06:21:22Z")

</div>

Which OS ya running for plex and the version of plex? (i’m assuming some flavor of linux since ya were changing permissions). Also, could you look at the plugin log file to see if it is throwing any errors.  
You may have to restart plex, though I haven’t needed to do it with ubuntu. And I didn’t have to Disable capability checking. I just tried it with it checked as well and the channel still showed up for me, so I don’t think that has anything to do with it.

---

<div class="post-metadata">

**Author:** ![c00l8thome](https://avatars.discourse-cdn.com/v4/letter/c/f17d59/32.png) [@c00l8thome](https://forums.plex.tv/u/c00l8thome)\
**Post date:** [March 12, 2017, 2:59pm UTC](https://forums.plex.tv/t/plex-mythtv-livetv-channel-plugin/183505/4 "2017-03-12T14:59:22Z")

</div>

I am running Ubuntu 16.04 with PMS 1.4.3.3433. I did perform a reboot with no luck.  
This is the output of plugin log:  
[…]  
581: CRITICAL (core:615) - Exception starting plug-in (most recent call last):  
File “/usr/lib/plexmediaserver/Resources/Plug-ins-03e4cfa35/Framework.bundle/Contents/Resources/Versions/2/Python/Framework/core.py”, line 608, in start  
self.sandbox.execute(self.init\_code)  
File “/usr/lib/plexmediaserver/Resources/Plug-ins-03e4cfa35/Framework.bundle/Contents/Resources/Versions/2/Python/Framework/code/sandbox.py”, line 256, in execute  
exec(code) in self.environment  
File “/var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Plug-ins/MythLive.bundle/Contents/Code/ **init**.py”, line 13, in   
ALL\_CHANNELS = ‘http://’+MYTHTV\_HOSTNAME+’:6544/Guide/GetProgramGuide?StartTime=’+utc\_datetime.strftime("%Y-%m-%dT%H:%M:%S")+’&EndTime=’+(utc\_datetime+datetime.timedelta(seconds=60)).strftime("%Y-%m-%dT%H:%M:%S")+"&Details=true"  
TypeError: cannot concatenate ‘str’ and ‘NoneType’ objects

---

<div class="post-metadata">

**Author:** ![unsober](https://avatars.discourse-cdn.com/v4/letter/u/2bfe46/32.png) [@unsober](https://forums.plex.tv/u/unsober)\
**Post date:** [March 12, 2017, 3:36pm UTC](https://forums.plex.tv/t/plex-mythtv-livetv-channel-plugin/183505/5 "2017-03-12T15:36:39Z")

</div>

Try downloading the bundle again from the original post and giving it another shot.

The Default preference for mythtv server was blank from the start which i apparently didnt run into. I just made the default localhost so the bundle should load. I’ll eventually make an update to the code to do the error checking.

When it does load, you’ll need to click on the gear and configure the host. All the other settings can be left alone. You may want to eventually update the categories though.

---

<div class="post-metadata">

**Author:** ![c00l8thome](https://avatars.discourse-cdn.com/v4/letter/c/f17d59/32.png) [@c00l8thome](https://forums.plex.tv/u/c00l8thome)\
**Post date:** [March 12, 2017, 4:26pm UTC](https://forums.plex.tv/t/plex-mythtv-livetv-channel-plugin/183505/6 "2017-03-12T16:26:48Z")

</div>

Great, thank you, that worked. I can see the channel now. While I am currently unable to see the livetv stream in plex, I was able to verify that my mythtv server switched the encoder to the right channel and started recording.  
Any idea why the channel is not able to display the picture?

---

<div class="post-metadata">

**Author:** ![unsober](https://avatars.discourse-cdn.com/v4/letter/u/2bfe46/32.png) [@unsober](https://forums.plex.tv/u/unsober)\
**Post date:** [March 12, 2017, 5:23pm UTC](https://forums.plex.tv/t/plex-mythtv-livetv-channel-plugin/183505/7 "2017-03-12T17:23:15Z")

</div>

My guess is you are using a different tuner than me (i’m using hdhomerun prime). I updated the bundle again and put in options to set the video container/codec. Based on what the container and codecs, you would have to update those settings.

I found these codecs available from an older post  
h263  
h264  
vp6  
wvc1  
divx  
div4  
xvid  
theora

I havent searched for the audio codec or container options yet (i know mp4 is available as a container). I’ll take a look for those a bit later and post

---

<div class="post-metadata">

**Author:** ![c00l8thome](https://avatars.discourse-cdn.com/v4/letter/c/f17d59/32.png) [@c00l8thome](https://forums.plex.tv/u/c00l8thome)\
**Post date:** [March 12, 2017, 7:14pm UTC](https://forums.plex.tv/t/plex-mythtv-livetv-channel-plugin/183505/8 "2017-03-12T19:14:48Z")

</div>

I am using a ceton 6 tuner pci cable card

---

<div class="post-metadata">

**Author:** ![unsober](https://avatars.discourse-cdn.com/v4/letter/u/2bfe46/32.png) [@unsober](https://forums.plex.tv/u/unsober)\
**Post date:** [March 12, 2017, 8:18pm UTC](https://forums.plex.tv/t/plex-mythtv-livetv-channel-plugin/183505/9 "2017-03-12T20:18:43Z")

</div>

What do you normally use the play tv (mythfronend/kodi/something else?)? Do know know what codecs it uses when you play it now? I looked up that card and it’s talking about all different formats.

I added another option to set the content-type for the video returned from the myth php, though i was changing that to all sorts of things and it still worked fine for me, so i dont think it really makes an impact. I uploaded a new stream.php and bundle.

If i change those initial codec settings to something other than what the hdhomerun is delivering (mpeg2) it causes it to kick off the livetv recording but not play on plex, so If you can narrow down the codecs being used I think that would help as I think that’s probably the issue.

We’ll have to start diving into the logs if ya can’t identify the ceton codecs being used.

---

<div class="post-metadata">

**Author:** ![c00l8thome](https://avatars.discourse-cdn.com/v4/letter/c/f17d59/32.png) [@c00l8thome](https://forums.plex.tv/u/c00l8thome)\
**Post date:** [March 12, 2017, 9:17pm UTC](https://forums.plex.tv/t/plex-mythtv-livetv-channel-plugin/183505/10 "2017-03-12T21:17:14Z")

</div>

I use a combination of mythfrontend and kodi running on various hardware  
throughout my house. I just double checked and my recordings as well as  
live tv uses H.264 as the codec

---

<div class="post-metadata">

**Author:** ![unsober](https://avatars.discourse-cdn.com/v4/letter/u/2bfe46/32.png) [@unsober](https://forums.plex.tv/u/unsober)\
**Post date:** [March 13, 2017, 2:16am UTC](https://forums.plex.tv/t/plex-mythtv-livetv-channel-plugin/183505/11 "2017-03-13T02:16:15Z")

</div>

can you try the following, if you haven’t done so already…

Which container is used by the MythTV Tuner?  
mp4

Which video codec is used by the MythTV Tuner  
h264

Which audio codec is used by the MythTV Tuner  
ac3

What are the max channels the MythTV Tuner will provide?  
6 (may want to try 2 as well)

What is Content-Type to be delivered from the MythTV Server?  
video/mp4

If that don’t work, you can take a look at the kodi log when starting to play a tv recording, that might be helpful in troubleshooting as well.  
Key items would be…  
**CDVDVideoCodecFFmpeg::Open() Using codec: MPEG-2 video**  
**Creating audio stream (codec id: 86019, channels: 6, sample rate: 48000, no pass-through)**

Theres also an option when playing a video on kodi to display the video details which would give ya some good info. Need to look for Player process info\> video decoder & audio process stream.

---

<div class="post-metadata">

**Author:** ![unsober](https://avatars.discourse-cdn.com/v4/letter/u/2bfe46/32.png) [@unsober](https://forums.plex.tv/u/unsober)\
**Post date:** [March 15, 2017, 5:06am UTC](https://forums.plex.tv/t/plex-mythtv-livetv-channel-plugin/183505/12 "2017-03-15T05:06:30Z")

</div>

Updated both the bundle and the stream.php file.

Stream  
Fixed the disconnecting in between shows and having to restart, it plays continuously though the change in shows now.

Bundle  
Eliminated the fixed duration that was in there for livetv, it was set to 4 hours. It wasnt needed from what i can tell.  
Added program info start and end times to the channels for descriptive purposes. Shows up on the computer app and/or web browser, doesn’t show itself on mobile app

---

<div class="post-metadata">

**Author:** ![c00l8thome](https://avatars.discourse-cdn.com/v4/letter/c/f17d59/32.png) [@c00l8thome](https://forums.plex.tv/u/c00l8thome)\
**Post date:** [March 31, 2017, 7:06pm UTC](https://forums.plex.tv/t/plex-mythtv-livetv-channel-plugin/183505/13 "2017-03-31T19:06:47Z")

</div>

Sorry it took me so long to respond.  
I finally managed to get all the information for your questions together.

Which container is used by the MythTV Tuner?  
ts

Which video codec is used by the MythTV Tuner  
MPEG-2

Which audio codec is used by the MythTV Tuner  
ac3

What are the max channels the MythTV Tuner will provide?  
6

What is Content-Type to be delivered from the MythTV Server?  
video/ts

I will play with the settings this afternoon and report back if I have any luck streaming livetv

Thank you

---

<div class="post-metadata">

**Author:** ![c00l8thome](https://avatars.discourse-cdn.com/v4/letter/c/f17d59/32.png) [@c00l8thome](https://forums.plex.tv/u/c00l8thome)\
**Post date:** [April 1, 2017, 12:57pm UTC](https://forums.plex.tv/t/plex-mythtv-livetv-channel-plugin/183505/14 "2017-04-01T12:57:29Z")

</div>

I played around with the different settings and I am still not able to get a picture. I do see that the tuners change to the selected channel but no luck on actually seeing a picture.  
My settings are:

1. bytes 48000
2. container mpgets
3. video codec mpeg2video
4. audio codec ac3
5. max channels 6
6. bitrate 8000
7. content-type: video/ts  
Please let me know if I need to change the settings … thank you

---

<div class="post-metadata">

**Author:** ![markroberts906](https://avatars.discourse-cdn.com/v4/letter/m/3bc359/32.png) [@markroberts906](https://forums.plex.tv/u/markroberts906)\
**Post date:** [October 8, 2017, 4:36am UTC](https://forums.plex.tv/t/plex-mythtv-livetv-channel-plugin/183505/15 "2017-10-08T04:36:37Z")

</div>

Thank you for this channel. I had to tweak a few things to get it working but seems to be great now! I appreciate all your hard work in making this available.

Just a note if anyone is still trying to get it working, you likely will have to play with the stream.php file to match up some things. For me, the Myth\_Protocol commands were mismatched some. The hostname is hard set in at least one spot which I had to update for my myth server name. I also have a different MYTH\_PROTO\_VERSION so might have to update those for your environment as well. I also used an optional name for my HDHomeRun tuners (in Myth Backend Setup) which I removed so they are blank and would match the regex used to find an available tuner. They should be either blank or return Input 1, Input 2, etc.

Just a couple pointers if anyone like me is looking at this gem and is struggling. It is worth it but may take a bit of time parsing logs to find everything.

---

<div class="post-metadata">

**Author:** ![unsober](https://avatars.discourse-cdn.com/v4/letter/u/2bfe46/32.png) [@unsober](https://forums.plex.tv/u/unsober)\
**Post date:** [December 15, 2017, 5:56am UTC](https://forums.plex.tv/t/plex-mythtv-livetv-channel-plugin/183505/16 "2017-12-15T05:56:02Z")

</div>

Been a while, but I circled back to this and updated a few things.

Based on feedback within the thread…

1. stream.php updated to remove hardcoded hostname. I also included options for accepting mythtv protocol version and token
2. updated bundle to add configuration options when you go into the channel setup for protocol version and token  
… so everything can be done within the channel config now within plex vs jumping into the code. you would obviously need to know the protocol version and token for the version for myth you are running.

This was working fine for me on iphones plex app, mac plex app, windows plex app and the web versions across devices.

I got a firestick and it was not working properly. Changing the container to MP4 solved that issue and it still works on all the other devices, so i set the default value to MP4.

Again, i’m working with a HDHOMERUN Prime as the tuner. If you are using other devices, you may need to update the other settings based on the container/codecs/bitrate of the tuner you are using.

I’ve been using it for quite some time now without issue (other than the recent firestick hiccup). If it works for you…Enjoy!

---

<div class="post-metadata">

**Author:** ![piotr.oniszczuk\_gmail.com](https://avatars.discourse-cdn.com/v4/letter/p/ec9cab/32.png) [@piotr.oniszczuk\_gmail.com](https://forums.plex.tv/u/piotr.oniszczuk_gmail.com)\
**Post date:** [December 20, 2017, 3:35pm UTC](https://forums.plex.tv/t/plex-mythtv-livetv-channel-plugin/183505/17 "2017-12-20T15:35:34Z")

</div>

Hi there,  
If anybody wants to play with excellent unsober work and current mythtv master (v29 should also work) in DVB word:

[github.com/warpme/plex-plugin-mythtv-livetv](https://github.com/warpme/plex-plugin-mythtv-livetv "https://github.com/warpme/plex-plugin-mythtv-livetv")

main changes are:  
-support for MYTH\_PROTO for current mythv master (and v29)  
-plugins settings defaults suitable for DVB(S/S2/T/C)  
-support for mythtv multirec setups

happy watching!

---

<div class="post-metadata">

**Author:** ![c00l8thome](https://avatars.discourse-cdn.com/v4/letter/c/f17d59/32.png) [@c00l8thome](https://forums.plex.tv/u/c00l8thome)\
**Post date:** [December 30, 2017, 12:06am UTC](https://forums.plex.tv/t/plex-mythtv-livetv-channel-plugin/183505/18 "2017-12-30T00:06:43Z")

</div>

I am still having trouble getting it to work. How do I find out the values for the MythTV LiveTV Settings ?  
Thank you

---

<div class="post-metadata">

**Author:** ![warpme\_o2.pl](https://avatars.discourse-cdn.com/v4/letter/w/898d66/32.png) [@warpme\_o2.pl](https://forums.plex.tv/u/warpme_o2.pl)\
**Post date:** [December 30, 2017, 11:31am UTC](https://forums.plex.tv/t/plex-mythtv-livetv-channel-plugin/183505/19 "2017-12-30T11:31:21Z")

</div>

Hi, \> @c00l8thome said:

> I am still having trouble getting it to work. How do I find out the values for the MythTV LiveTV Settings ?  
> Thank you

If You are asking for plugin settings then: when You put muse over channel icon - You will see white cogwheel down left. Click on it and You will see settings page. Comments on fields should help You with settings. Defaults should be OK when You have PLEX on the same host like myth BE and web server.

Do You have already working .php script for streaming from Your http server (i.e. tested on VLC as stated in install instructions on my Git repo)?

br

---

<div class="post-metadata">

**Author:** ![c00l8thome](https://avatars.discourse-cdn.com/v4/letter/c/f17d59/32.png) [@c00l8thome](https://forums.plex.tv/u/c00l8thome)\
**Post date:** [December 30, 2017, 3:36pm UTC](https://forums.plex.tv/t/plex-mythtv-livetv-channel-plugin/183505/20 "2017-12-30T15:36:01Z")

</div>

Hi Piotr,

I am running mythtv on a ubuntu 16.04 installation with apache2. I have moved the plex-plugin-mythtv-livetv.php file into the /var/www/html/ directory, updated my IP address and logging and made it universally accessible.  
If I point VLC to http:///plex-livetv-feeder.php?chanid=1&verbose=Debug I receive not feedback. If I point my browser to the same address is see the page.

So to answer your question, I don’t think I have a working .php script.

Any thoughts/ help would be greatly appreciated.  
Thank you

[Next page](https://forums.plex.tv/t/plex-mythtv-livetv-channel-plugin/183505.md?page=2)
