VLC channel

I am trying to stream an mp4 file from a URL into Plex to view through Roku and the Plex plugin.

Plex can find video URLs on some websites, but not all.

I can obtain the URL for the actual video file (see #VLCURL below).  But Plex will not Queue it up.

I can read the URL through VLC and stream it back out for Plex, however, I always get the message that the channel is currently unavailable.

 

The channel code:

 

####################################################################################################
 
PREFIX       = '/video/vlcplayer'
TITLE        = 'VLC Player'
ART          = 'art-default.jpg'
ICON         = 'icon-vlc.png'
VLCURL       = 'http://127.0.0.1:11223'
#VLCURL       = 'http://cs514220v4.vk.me/u5723140/videos/88479e1a6c.360.mp4'
 
####################################################################################################
def Start():
 
    ObjectContainer.title1 = TITLE
    ObjectContainer.art = R(ART)
 
    DirectoryObject.thumb = R(ICON)
    DirectoryObject.art = R(ART)
    VideoClipObject.thumb = R(ICON)
    VideoClipObject.art = R(ART)
    
    HTTP.CacheTime = CACHE_1HOUR
 
    
####################################################################################################
@handler(PREFIX, TITLE, thumb=ICON)
def MainMenu():
oc = ObjectContainer()
 
mo = MediaObject(parts=[PartObject(key=HTTPLiveStreamURL(VLCURL))])
 
vco = VideoClipObject(title="Play local VLC stream", url=VLCURL)
 
vco.add(mo)
oc.add(vco)
 
return oc
 
####################################################################################################
 
 
The error:
2014-01-24 22:18:27,512 (1868) :  WARNING (objectkit:199) - Media part has no streams - attempting to synthesize
2014-01-24 22:18:27,513 (1868) :  DEBUG (services:602) - No service found for URL 'http://127.0.0.1:11223'
2014-01-24 22:18:27,513 (1868) :  DEBUG (services:617) - No matching services found for 'http://127.0.0.1:11223'
2014-01-24 22:18:27,513 (1868) :  DEBUG (services:41) - Loading service code for Fallback (URLServiceRecord)
 
 
The VLC output stream options:
:sout=#transcode{vcodec=h264,acodec=mpga,ab=128,channels=2,samplerate=44100}:standard{access=http,mux=ts,dst=localhost:11223} :sout-all
 
 

Does someone see what I am doing wrong?

 

Thanks.

Well, I am making progress.  I started reading "PlexPlug-inFramework.pdf" from http://dev.plexapp.com/docs/offline/PlexPlug-inFramework.pdf

Specifically starting at page 25.

I added the PlexURLServices info to the Info.plist file.

I copied the YouTube ServiceCode.pys as a starting point from C:\Users\User\AppData\Local\Plex Media Server\Plug-ins\Services.bundle\Contents\Service Sets\com.plexapp.plugins.youtube\URL\YouTube

I am still working on modifying that file.

This seems to resolve the  No service found for URL error.  I now get a new error because I haven't completed the ServiceCode file.  The work continues.

There have been 80 views of this post at this time, yet no one has commented.

Any help or pointers will be appreciated.  I am learning some Python in this process also.

I there a way to run these plugins in a debugger to step through them or to print to the log file (old school)?

Thanks.

You will find more helpful information and advice in the Channel Development section of the forum - https://forums.plex.tv/forum/42-channel-development/

Seems like your situation doesn't really lend itself particularly well to using an URL service. That means that passing the url="..." argument to the VideoClipObject is a no-no. You'll need to pass the key and rating_key arguments instead. Take a look at how the IMDB-Trailers channel is written.

Hi Mikedm139.  Thanks for replying.

I am working on understanding the difference between the two calls to the VideoClipObject method. I started on this base on some posts by Murderous Moppet.  I'm not sure that he was successful in this venture.  He was very helpful for VLC issues.  Some of your other posts seemed to indicate that the URL service method might not be a workable strategy, but did not seem to be definitive  You seem to be saying here, that it is not possible (at least as far as you know).  Being a noob at this, I need to do a little thinking to try to get a grip on it.  You obviously have been at this a while.

I don't understand how a website stream is controlled by a viewer application.  There is obviously more control that a viewer will have over the stream than I will have  (at least at first) over the VLC player.  The first step is just to get video and audio streaming to the Roku (no matter how out of control it is).

It looks like (from your code) that either way I will have to create an equivalent to the metadata extracted from a URL.  You seem to extract metadata from a URL (somewhat similar to the YouTube plugin) in the CreateTrailerObject method. The data I use obviously doesn't have to be informative, just satisfy Plex.  When viewing a VLC stream, you already know what you should be seeing.

I think that I may have a good start on the metadata part.  I need to read and get a better understanding of what the key and rating_key arguments are all about.

Your example does not even use the VideoClipObject.  It looks like you are doing something very different with IMDB.

Any additional pointers you could throw at me will be greatly appreciated.

Thank you for taking the time to respond and for the information.

The MovieObject used in the IMDB-Trailers channel is functionally similar to a VideoClipObject with a few minor differences in the sort of metadata it will accept. http://dev.plexapp.com/docs/api/objectkit.html#MovieObject

The key point when using an URL Service is that the given URL should be unique and point specifically to one video. In your case, where the localhost URL for the VLC stream could return any video you choose to stream via VLC, an URL service isn't really a good choice. However, the plugin framework is very much geared towards the use of URL Services, such that using one gives a lot of the behind the scenes setup for free. When not using an URL Service you have to do all of that setup in your own code.

Unfortunately, there isn't really a good guide on how to do it because it's not the "preferred" method of adding channel content so you're in less traveled territory.

A few key points to remember:

  • if you pass the 'url' parameter to a VideoClipObject (or similar media-type object), the framework will look for an URL Service to handle that URL.
  • if you don't have/want an URL Service, you must provide both 'key' and 'rating_key' parameters to your VideoClipObject.
  • the 'key' should be a callback which will return (essentially) the same object again with as much metadata as you can reasonably provide
  • the 'rating_key' should be a unique string identifying the video, usually the unique URL is used but that obviously won't work in your case.

Take a look a few other non-URL-Service channels to help wrap your head around the concept and compare the differences to other channels that do use URL Services. It will really help straighten out the concepts.

Thanks Mikedm139 for the suggestions and examples.  I am making progress.

Right now I am using the URL as the rating_key.  I actually get a play button when I click on the VLC Player icon.

I'll try to actually stream to it tomorrow.

Questions:  

Is the code: return MessageContainer("Error", "That is not a valid IP address.")  ->  supposed to return an alert like popup when called in ValidatePrefs()?

I see an entry in the log if it gets executed and no errors, but nothing in the Plex interface.

Do you know why there is no constant for mpegts like Container.MPEGTS like there is for Container.MP4?

Thanks again.

Is the code: return MessageContainer("Error", "That is not a valid IP address.")  ->  supposed to return an alert like popup when called in ValidatePrefs()?

MessageContainer has been deprecated. Try:

return ObjectContainer(header="Error", message="This is not a valid IP address.")

Do you know why there is no constant for mpegts like Container.MPEGTS like there is for Container.MP4?

There isn't one at the moment, probably because HTTP Live Streams weren't very popular at the time the constants were added to the framework.

But there's nothing wrong with using 'mpegts' for now.

Thanks for the help, sander1.  I tried the return ObjectContainer method.  There is no error, but there also is no alert type of popup telling me I entered something wrong.

Whatever it did, it didn't provide user feedback, which is what I am looking for.

Regarding mpegts, thanks.  That is what I am doing  At least I know I'm not doing something stupid.

Am I missing something else?

Here is the code:

def ValidatePrefs():
  match = re.search(RE_IP_MAP, Prefs['vlc_host'])
  if match == None:
    return ObjectContainer(header="Error", message="This is not a valid IP address.")
  Log.Debug("HHHH  vlc_host= "+match.group(0))
  match = re.search(RE_PORT_MAP, Prefs['vlc_port'])
  if match == None:
    return ObjectContainer(header="Error", message="That is not a valid IP port.")
  Log.Debug("PPPP  vlc_port= "+match.group(0))
  return

I seem to have it working.  It doesn't seem to be perfect yet, but I can watch the live stream with audio through the Roku.  Yea!

If someone would like to look over the code for potential issues and make some comments, I would really appreciate it.

ie., Expert review of the work of a noob would be greatly appreciated.

Thanks.

I seem to have it working.  It doesn't seem to be perfect yet, but I can watch the live stream with audio through the Roku.  Yea!

If someone would like to look over the code for potential issues and make some comments, I would really appreciate it.

ie., Expert review of the work of a noob would be greatly appreciated.

Thanks.

I would suggest posting it to Github and leave a link in this thread. Makes it very easy for others to review the code as well as download it, try it out, make changes and send you updates.

The source for this project is at:

https://github.com/wtw2/VLC_Channel

Any comments will be greatly appreciated.

The Current_problems.txt file contains what it says.

Thanks.

One things I noticed from your code is that you seem to be using alot if old code wih your objects (like the mo= and vco=). This is no longer used and can cause some errors. Now you just define your variables and use and oc.add() . Look back at some of the links mike gave you for the newer method of building your objects in the channel code.

One things I noticed from your code is that you seem to be using alot if old code wih your objects (like the mo= and vco=).

That's not old code, that's just a different (not wrong) way of writing things.

If using variable names (no matter how lame) instead of building the object all in one line causes problems or errors, there is a really big problem here.

BTW, old programming goes well with old programmers (like me B) )

I'll hopefully commit more changes today.  I almost have the message problem fixed.

Kind Regards.

That's not old code, that's just a different (not wrong) way of writing things.

Sorry about that.

I think I may have been confusing this with its use for the attributes of an object. Though of course I cannot find any examples of it now, I thought I remembered seeing old code where those mo or vco variables were used to build the attributes for the objects (the code was something like vco.title=) and then just the variable for the object was added (the code was something like vco.add or add.vco). But this whole paragraph is confusing and pointless so again sorry for the bad advice.

This channel is actually working now.  Not bad for a guy who only learned about Plex and Roku and got involved in late January.

The latest source for this project is at:

https://github.com/wtw2/VLC_Channel

 

Many thanks to Mikedm139 for providing links for example channels for reference.

 

It appears that development can result in the Media Manager and/or PMS doing bazaar things after a while. I gave up last night because it would not execute a callback method that only entered a Log.Debug() entry.  It works this morning, no problem.  I probably needed to restart PMS.  It tends to throw many errors when I am developing and testing :( . 

 

There are new features and more are now in progress (VLC Play/Pause/Stop).

Some data (VLC exe path etc.) are specific to my PC, they are at the top of the __init__.py file and can easily be changed.

 

If someone wold like to test it out and leave feedback, that would be greatly appreciated.  Feel free to ask questions as the process is not quite user friendly yet.  It can also, though only occasionally, be ill tempered.

The purpose of this channel plugin is to make streams, which Plex cannot normally access, available for viewing on Roku.  The only requirement is that VLC can access those streams, which can make many streams accessible now.

 

There appears to be others that have tried something like this for sports event streams etc.  Success seems to vary or they got something working and disappeared.  With this plugin, as long as you can find the stream file URL (like using a URL sniffer), you can view it through Roku on your favorite display system.

It should also work easily for DVDs and files, but there are better methods for those applications.

Is this the holy grail? Will I be able to stream what plays on my VLC player (my ripped dvds in vob files, etc) to my tv via roku?

Hi sanjeevds.

Sorry for not replying sooner.  I was working on the code.  Just uploaded the latest to GitHub tonight (2/11/2014).

I haven't used it with dvd rips.  If VLC can play it, you should be able to use this channel to get it to the Roku.

I need to add a way to enter the dvd uri in settings, but there is a workaround.  What you can do is launch VLC from within Plex Media Manager using the channel's "Launch VLC".  Then, when Plex isn't "looking", add the dvd item(s) to the play list, then use the channel to access the playlist and select the item you want.  You can do this on the Roku also.  Then, on the Roku, you can start VLC playing using the VLC channel within the Plex channel and then use the "VLC Video Stream" icon to start looking for the stream on the Roku.

I just had it working.  It took about 4 minutes to actually start playing the stream (http feed of an internet based mp4), but it did not start at the 4 min mark, it started a few seconds into the stream.

There is really no control over VLC during playing.  You can pause and resume.

You watch a stream, then pick a new playlist item and watch that.

It is not perfect yet.  I am just now starting to use it to stream.  I've been coding a lot to get a realistic interface and functionality.

If you need help, just let me know.  You can post or send a private message.

Thanks.

New release today.

https://github.com/wtw2/VLC_Channel

The VLC control interface seems to be very stable and complete.  The UI is friendly and should be a lot more useful on Roku.  Refresh works well if Plex and VLC get out of sync (shouldn't be likely; this helps if you are trying things on the PC with Plex and VLC open).  More options and features in this release.

Is anyone else interested in this channel app?

There were at least a couple people intently looking for something like this.

It should be a good example for others if nothing else.

Thanks.