# Channel to View VLC Stream

**URL:** <https://forums.plex.tv/t/channel-to-view-vlc-stream/32979>\
**Category:** Dev/API Corner\
**Tags:** plugin-dev\
**Created:** [April 17, 2013, 9:42pm UTC](https://forums.plex.tv/t/channel-to-view-vlc-stream/32979 "2013-04-17T21:42:37Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![FRITZ\_FRITZ](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/fritz_fritz/32/3558_2.png) [@FRITZ\_FRITZ](https://forums.plex.tv/u/FRITZ_FRITZ)\
**Post date:** [April 17, 2013, 9:42pm UTC](https://forums.plex.tv/t/channel-to-view-vlc-stream/32979/1 "2013-04-17T21:42:37Z")

</div>

Essentially what i'm trying to do is create a plex plugin that will allow me to watch a live stream.

&nbsp;

I am currently using vlc to successfully tune my tvtuner and can stream to other vlc clients. I have the best success using an RTP stream with no transcoding simply providing the ts encapsulation as it is received over the air.&nbsp;

&nbsp;

```
cvlc atsc://frequency=605029000 --sout '#rtp{dst=10.0.1.8,port=5004,mux=ts,ttl=1}' --sout-keep -d
```

Using a separate instance of vlc I can open the network stream using rtp://10.0.1.8:5004 and it streams butter smooth.

&nbsp;

&nbsp;

I have also successfully streamed content using HTTP Live Streaming (HLS) as designed by Apple:

&nbsp;

```
cvlc -I dummy --ffmpeg-hw atsc://frequency=605000000 :live-cache=5000 --sout='#transcode{vcodec=h264,vb=200,fps=30,scale=.5,venc=x264{aud,level=50,keyint=15,bframes=0,ref=1},acodec=aac,ab=40,channels=2,samplerate=22050}:duplicate{dst=std{mux=ts,dst=-,access=livehttp{seglen=30,delsegs=true,numsegs=20,index=/var/www/stream/live.m3u8,index-url=content/live-######.ts},mux=ts{use-key-frames},dst=/var/www/stream/content/live-######.ts,ratecontrol=true}}' 
```

This generates a .m3u8 file which is dynamically updated as new clips are processed. It is accessible in safari on the iphone.

&nbsp;

What I'm trying to do is create a plugin that will grab that live feed (preferably an rtp stream) and transcode it on the fly for my clients.

&nbsp;

&nbsp;

I have created a plugin which I thought would essentially look at that address (10.0.1.8:5004) and transcode it for whichever client I am using. However, I can't get it to actually find the stream!

&nbsp;

#############################

Here's my init.py:

#############################

```
# Autor: Roland Fritz 
# Date: 7/31/2012
# About: This plugin is designed to enable live TV viewing on Plex clients. Required for this to
# to work is a usb DTV tuner and vlc.
#
# NOTE: I do not make any guarantees that this will work for you. I do not endorse using this for
# anything beyond personal use. This has been tested to work on Ubuntu server 12.04 running PMS.
#
# Version: 0.1
#

#import mechanize  
VIDEO\_PREFIX = “/video/fritztv”  
NAME = L(‘Title’)  
ART = ‘art-default.jpg’  
ICON = ‘icon-default.jpg’  
NAMESPACES = {‘a’:‘[http://xspf.org/ns/0/](http://xspf.org/ns/0/)’}

####################################################################################################  
def Start():

```
Plugin.AddPrefixHandler(VIDEO_PREFIX, MainMenu, NAME, ICON, ART)

Plugin.AddViewGroup("InfoList", viewMode="InfoList", mediaType="items")
Plugin.AddViewGroup("List", viewMode="List", mediaType="items")

MediaContainer.title1 = NAME
MediaContainer.viewGroup = "List"
MediaContainer.art = R(ART)
DirectoryItem.thumb = R(ICON)
VideoItem.thumb = R(ICON)

```

# HTTP.CacheTime = CACHE\_1HOUR

def MainMenu():  
oc = ObjectContainer(title1=“VLC Player”)

```
mo = MediaObject(parts=[PartObject(key=HTTPLiveStreamURL("10.0.1.8:5004"))])

vco = VideoClipObject(title="Play local VLC stream", url='10.0.1.8:5004')
vco.add(mo)
oc.add(vco)

return oc

```
```

&nbsp;

&nbsp;

&nbsp;

&nbsp;

#############################

And Here's the Log

#############################

```
2013-04-17 13:44:50,161 (-48d91700) : INFO (core:336) - Starting framework core - Version: 2.3.4, Build: 7570849 (Tue Apr 9 16:23:58 UTC 2013)
2013-04-17 13:44:50,161 (-48d91700) : DEBUG (core:348) - Using the standard policy
2013-04-17 13:44:50,162 (-48d91700) : DEBUG (core:437) - Starting runtime component.
2013-04-17 13:44:50,164 (-48d91700) : DEBUG (core:437) - Starting caching component.
2013-04-17 13:44:50,165 (-48d91700) : DEBUG (core:437) - Starting data component.
2013-04-17 13:44:50,166 (-48d91700) : DEBUG (core:437) - Starting networking component.
2013-04-17 13:44:50,177 (-48d91700) : DEBUG (networking:318) - Loaded HTTP cookies
2013-04-17 13:44:50,237 (-48d91700) : DEBUG (networking:504) - Setting the default network timeout to 20.0
2013-04-17 13:44:50,238 (-48d91700) : DEBUG (core:437) - Starting localization component.
2013-04-17 13:44:50,249 (-48d91700) : INFO (localization:408) - Setting the default locale to en-us
2013-04-17 13:44:50,250 (-48d91700) : DEBUG (localization:426) - Loaded en strings
2013-04-17 13:44:50,250 (-48d91700) : DEBUG (core:437) - Starting messaging component.
2013-04-17 13:44:50,251 (-48d91700) : DEBUG (core:437) - Starting debugging component.
2013-04-17 13:44:50,251 (-48d91700) : DEBUG (core:437) - Starting services component.
2013-04-17 13:44:50,252 (-48d91700) : DEBUG (core:437) - Starting myplex component.
2013-04-17 13:44:50,252 (-48d91700) : DEBUG (core:437) - Starting notifications component.
2013-04-17 13:44:50,275 (-4dd054c0) : DEBUG (networking:172) - Requesting 'http://127.0.0.1:32400/system/messaging/clear_events/com.plexapp.plugins.fritztv'
2013-04-17 13:44:50,563 (-48d91700) : DEBUG (accessor:68) - Creating a new model access point for provider com.plexapp.plugins.fritztv in namespace 'metadata'
2013-04-17 13:44:50,646 (-48d91700) : DEBUG (networking:172) - Requesting 'http://127.0.0.1:32400/:/plugins/com.plexapp.system/resourceHashes'
2013-04-17 13:44:50,967 (-48d91700) : DEBUG (runtime:1090) - Created a thread named 'load_all_services'
2013-04-17 13:44:50,968 (-4dd054c0) : DEBUG (services:265) - Plug-in is not daemonized - loading services from system
2013-04-17 13:44:50,972 (-48d91700) : DEBUG (runtime:1090) - Created a thread named 'get_server_info'
2013-04-17 13:44:50,975 (-48d91700) : DEBUG (core:149) - Finished starting framework core
2013-04-17 13:44:50,975 (-48d91700) : DEBUG (core:547) - Loading plug-in code
2013-04-17 13:44:50,973 (-4ed074c0) : DEBUG (networking:172) - Requesting 'http://127.0.0.1:32400'
2013-04-17 13:44:50,991 (-48d91700) : DEBUG (core:553) - Finished loading plug-in code
2013-04-17 13:44:51,034 (-4dd054c0) : DEBUG (networking:172) - Requesting 'http://127.0.0.1:32400/:/plugins/com.plexapp.system/messaging/function/X0J1bmRsZVNlcnZpY2U6QWxsU2VydmljZXM_/Y2VyZWFsMQoxCmxpc3QKMApyMAo_/Y2VyZWFsMQoxCmRpY3QKMApyMAo_'
2013-04-17 13:44:51,042 (-48d91700) : DEBUG (runtime:623) - Adding a prefix handler for 'FRITZTV' ('/video/fritztv')
2013-04-17 13:44:51,068 (-48d91700) : INFO (core:598) - Started plug-in
2013-04-17 13:44:51,068 (-48d91700) : DEBUG (socketinterface:144) - Starting socket server
2013-04-17 13:44:51,076 (-4ed074c0) : DEBUG (core:525) - Machine identifier is b51c1396cf6dfd857daa78c4ee9ddd57f97f76d1
2013-04-17 13:44:51,077 (-4ed074c0) : DEBUG (core:526) - Server version is 0.9.7.22.510-8faeab3
2013-04-17 13:44:51,080 (-48d91700) : DEBUG (runtime:1090) - Created a thread named 'start'
2013-04-17 13:44:51,080 (-48d91700) : INFO (socketinterface:168) - Socket server started on port 60346
2013-04-17 13:44:51,081 (-48d91700) : INFO (pipeinterface:25) - Entering run loop
2013-04-17 13:44:51,081 (-48d91700) : DEBUG (runtime:700) - Handling request GET /:/prefixes
2013-04-17 13:44:51,084 (-48d91700) : DEBUG (runtime:797) - Found route matching /:/prefixes
2013-04-17 13:44:51,102 (-48d91700) : DEBUG (runtime:897) - Response: [200] MediaContainer, 442 bytes
2013-04-17 13:44:51,429 (-4dd054c0) : DEBUG (services:362) - Loaded services
2013-04-17 13:44:51,437 (-4e5064c0) : DEBUG (services:438) - No shared code to load
2013-04-17 13:45:08,839 (-4dd054c0) : DEBUG (runtime:700) - Handling request GET /:/plugins/com.plexapp.plugins.fritztv/resources/icon-default.jpg?t=1366169333
2013-04-17 13:45:08,912 (-4e5064c0) : DEBUG (runtime:700) - Handling request GET /:/plugins/com.plexapp.plugins.fritztv/resources/icon-default.jpg?t=1366169333
2013-04-17 13:45:08,920 (-4dd054c0) : DEBUG (runtime:797) - Found route matching /:/plugins/com.plexapp.plugins.fritztv/resources/icon-default.jpg
2013-04-17 13:45:08,920 (-4e5064c0) : DEBUG (runtime:797) - Found route matching /:/plugins/com.plexapp.plugins.fritztv/resources/icon-default.jpg
2013-04-17 13:45:08,943 (-4e5064c0) : DEBUG (runtime:897) - Response: [200] DataObject, 23789 bytes
2013-04-17 13:45:08,973 (-4dd054c0) : DEBUG (runtime:897) - Response: [200] DataObject, 23789 bytes
2013-04-17 13:45:10,923 (-4dd054c0) : DEBUG (runtime:700) - Handling request GET /video/fritztv
2013-04-17 13:45:10,925 (-4dd054c0) : DEBUG (runtime:49) - Received packed state data (80 bytes)
2013-04-17 13:45:10,927 (-4dd054c0) : DEBUG (runtime:797) - Found route matching /video/fritztv
2013-04-17 13:45:10,927 (-4dd054c0) : WARNING (objectkit:193) - The 'platforms' attribute is deprecated and should not be assigned.
2013-04-17 13:45:10,928 (-4dd054c0) : WARNING (objectkit:193) - The 'protocols' attribute is deprecated and should not be assigned.
2013-04-17 13:45:10,929 (-4dd054c0) : DEBUG (base:123) - Checking if com.plexapp.plugins.fritztv is broken
2013-04-17 13:45:10,930 (-4dd054c0) : DEBUG (networking:172) - Requesting 'http://127.0.0.1:32400/:/plugins/com.plexapp.system/messaging/function/X1N0b3JlU2VydmljZTpJc0NoYW5uZWxCcm9rZW4_/Y2VyZWFsMQoxCmxpc3QKMApyMAo_/Y2VyZWFsMQoxCmRpY3QKMQpzMjcKY29tLnBsZXhhcHAucGx1Z2lucy5mcml0enR2czEwCmlkZW50aWZpZXJyMAo_'
2013-04-17 13:45:10,943 (-4dd054c0) : WARNING (objectkit:193) - Media part has no streams - attempting to synthesize
2013-04-17 13:45:10,949 (-4dd054c0) : DEBUG (services:602) - No service found for URL '10.0.1.8:5004'
2013-04-17 13:45:10,949 (-4dd054c0) : DEBUG (services:617) - No matching services found for '10.0.1.8:5004'
2013-04-17 13:45:10,956 (-4dd054c0) : DEBUG (services:41) - Loading service code for Fallback (URLServiceRecord)
2013-04-17 13:45:11,178 (-4dd054c0) : DEBUG (runtime:49) - Received packed state data (80 bytes)
2013-04-17 13:45:11,181 (-4dd054c0) : DEBUG (runtime:106) - Sending packed state data (108 bytes)
2013-04-17 13:45:11,182 (-4dd054c0) : DEBUG (runtime:897) - Response: [200] MediaContainer, 774 bytes
2013-04-17 14:14:36,146 (-4dd054c0) : DEBUG (runtime:700) - Handling request GET /video/fritztv
2013-04-17 14:14:36,149 (-4dd054c0) : DEBUG (runtime:797) - Found route matching /video/fritztv
2013-04-17 14:14:36,151 (-4dd054c0) : DEBUG (base:123) - Checking if com.plexapp.plugins.fritztv is broken
2013-04-17 14:14:36,172 (-4dd054c0) : DEBUG (networking:172) - Requesting 'http://127.0.0.1:32400/:/plugins/com.plexapp.system/messaging/function/X1N0b3JlU2VydmljZTpJc0NoYW5uZWxCcm9rZW4_/Y2VyZWFsMQoxCmxpc3QKMApyMAo_/Y2VyZWFsMQoxCmRpY3QKMQpzMjcKY29tLnBsZXhhcHAucGx1Z2lucy5mcml0enR2czEwCmlkZW50aWZpZXJyMAo_'
2013-04-17 14:14:36,183 (-4dd054c0) : DEBUG (services:602) - No service found for URL '10.0.1.8:5004'
2013-04-17 14:14:36,183 (-4dd054c0) : DEBUG (services:617) - No matching services found for '10.0.1.8:5004'
2013-04-17 14:14:36,187 (-4dd054c0) : DEBUG (runtime:106) - Sending packed state data (108 bytes)
2013-04-17 14:14:36,188 (-4dd054c0) : DEBUG (runtime:897) - Response: [200] MediaContainer, 774 bytes
```

Thanks,

&nbsp;

**FRITZ|FRITZ**

---

<div class="post-metadata">

**Author:** ![mikedm139](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/mikedm139/32/96909_2.png) [@mikedm139](https://forums.plex.tv/u/mikedm139)\
**Post date:** [April 17, 2013, 10:51pm UTC](https://forums.plex.tv/t/channel-to-view-vlc-stream/32979/2 "2013-04-17T22:51:16Z")

</div>

You won't have much luck with a RTP stream. PMS doesn't support it. Yes, FFMPEG does but PMS does not. Oh well. In theory, the HLS stream should work but you're constructing your VideoClipObject improperly. &nbsp;The current plugin framework is designed around URL Services. In your case, an URL Service isn't really going to add much benefit but going without one makes the \_\_init\_\_.py look a little more confusing.

When you're not using an URL Service, you must not set the 'url' attribute of the VideoClipObject. Instead you need to set the "key" and "rating\_key" attibutes. &nbsp;Usually the key is a callback and the rating\_key is a unique string to identify the video. Often the URL can be used as the rating\_key. I just re-wrote the [channel for Sesame Street](https://github.com/plexinc-plugins/Sesame-Street.bundle/blob/master/Contents/Code/ __init__.py#L86) using this method. It uses MP4 videos rather than m3u8, but the concept for structuring the VideoClipObject is pretty much the same.

---

<div class="post-metadata">

**Author:** ![Murderous\_Moppet](https://avatars.discourse-cdn.com/v4/letter/m/db5fbb/32.png) [@Murderous\_Moppet](https://forums.plex.tv/u/Murderous_Moppet)\
**Post date:** [April 18, 2013, 12:22am UTC](https://forums.plex.tv/t/channel-to-view-vlc-stream/32979/3 "2013-04-18T00:22:38Z")

</div>

[this thread](http://forums.plexapp.com/index.php/topic/41588-how-can-i-open-a-vlc-stream/)&nbsp;may provide you some useful information.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/plex/original/3X/2/a/2acb9765406f63293d357b4ec509ec39aa28f2ad.png) [@system](https://forums.plex.tv/u/system)\
**Post date:** [December 20, 2019, 11:14pm UTC](https://forums.plex.tv/t/channel-to-view-vlc-stream/32979/4 "2019-12-20T23:14:27Z")

</div>

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.
