problems getting live http stream into channel

First of all, hello plex community!

 

I'm totally new in developing a plex channel plugin, fortunately after doing some howtos I was able to make my first channel (which is shown in my PMS!) - thats the good part :-)

 

The bad part is as follows:

The reason why I'm developing this channel is, I'm using some kind of IP-TV and I want to get all the channels into the PMS. After some work I was able to reconfigure my NAS, so I'm now able to open the http media stream directly f.e. in VLC.

It's looking like that:  http://192.168.1.1:5555/udp/233.252.12.54:5004 -> this is a full http stream of one channel

 

When I open the stream in VLC and save it and open the saved file again with MediaInfo I get the following information:

 

Format                                   : MPEG-4
Format profile                           : Base Media
Codec ID                                 : isom
File size                                : 1.02 MiB
Duration                                 : 7s 944ms
Overall bit rate                         : 1 072 Kbps
Encoded date                             : UTC 2013-10-29 15:52:51
Tagged date                              : UTC 2013-10-29 15:52:51
Writing application                      : vlc 2.1.0 stream output

Video
ID                                       : 2
Format                                   : AVC
Format/Info                              : Advanced Video Codec
Format profile                           : High@L3.0
Format settings, CABAC                   : Yes
Format settings, ReFrames                : 4 frames
Codec ID                                 : avc1
Codec ID/Info                            : Advanced Video Coding
Duration                                 : 7s 760ms
Source duration                          : 7s 800ms
Bit rate                                 : 945 Kbps
Width                                    : 720 pixels
Height                                   : 576 pixels
Display aspect ratio                     : 16:9
Frame rate mode                          : Constant
Frame rate                               : 25.000 fps
Standard                                 : PAL
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Scan type                                : Progressive
Bits/(Pixel*Frame)                       : 0.091
Stream size                              : 896 KiB (86%)
Source stream size                       : 907 KiB (87%)
Language                                 : English
Encoded date                             : UTC 2013-10-29 15:52:51
Tagged date                              : UTC 2013-10-29 15:52:51
mdhd_Duration                            : 7760

Audio
ID                                       : 1
Format                                   : MPEG Audio
Format version                           : Version 1
Format profile                           : Layer 2
Codec ID                                 : 6B
Duration                                 : 7s 944ms
Source duration                          : 7s 970ms
Bit rate mode                            : Constant
Bit rate                                 : 128 Kbps
Channel(s)                               : 2 channels
Sampling rate                            : 44.1 KHz
Compression mode                         : Lossy
Stream size                              : 124 KiB (12%)
Source stream size                       : 124 KiB (12%)
Language                                 : German
Encoded date                             : UTC 2013-10-29 15:52:51
Tagged date                              : UTC 2013-10-29 15:52:51
mdhd_Duration                            : 7944

 

 

I now tried to open this stream in plex (http://192.168.1.1:5555/udp/233.252.12.54:5004) like:

 

(this is the important part of my ServiceCode.pys - I guess...):

def MediaObjectsForURL(url):
    return [
        MediaObject(
                        #video_codec = VideoCodec.VP6,
                        video_codec = VideoCodec.H264,
			audio_codec = AudioCodec.AAC,
                        container = 'mp2ts',
			#container = 'mpgv',
			#container = 'mpga',
			audio_channels = 2,
			video_resolution = '720',
			#container = Container.MP4,
			optimized_for_streaming = True,
                        #parts = [PartObject(key=HTTPLiveStreamURL(Callback(PlayVideo, url = url)))]
			#parts = [PartObject(key=Callback(PlayVideo, url = url))]
			parts = [PartObject(key=url)]
		)
    ]

def PlayVideo(url):
#video_url = RE_VIDEO_URL.search(page).group(‘video_url’)
#return Redirect(BASE_URL + video_url)
return Redirect(‘http://192.168.1.1:5555/udp/233.252.12.54:5004’)

As you can see, I tried a lot of codecs containers, etc... unfortunately I always got the following errors or just a Warning:

 

Errors like:

"Cannot load M3U8: 404 not found"
MIME type wrong...
Or

just a warning like:

...
DEBUG (core:553) - Finished loading plug-in code
2013-10-30 13:51:29,379 (4000) :  DEBUG (runtime:640) - Adding a prefix handler for 'Myplugin' ('/video/myplugin')
2013-10-30 13:51:29,386 (4000) :  INFO (core:598) - Started plug-in
2013-10-30 13:51:29,387 (4000) :  DEBUG (socketinterface:144) - Starting socket server
2013-10-30 13:51:29,390 (4000) :  DEBUG (runtime:1107) - Created a thread named 'start'
2013-10-30 13:51:29,391 (4000) :  INFO (socketinterface:168) - Socket server started on port 55789
2013-10-30 13:51:29,391 (4000) :  INFO (pipeinterface:25) - Entering run loop
2013-10-30 13:51:29,392 (4000) :  DEBUG (runtime:717) - Handling request GET /:/prefixes
2013-10-30 13:51:29,400 (4000) :  DEBUG (runtime:814) - Found route matching /:/prefixes
2013-10-30 13:51:30,022 (2800a) :  DEBUG (services:362) - Loaded services
2013-10-30 13:51:30,032 (4000) :  DEBUG (runtime:914) - Response: [200] MediaContainer, 448 bytes
2013-10-30 13:51:30,046 (2c00b) :  DEBUG (services:438) - No shared code to load
2013-10-30 13:51:30,079 (3800a) :  DEBUG (runtime:717) - Handling request GET /video/myplugin
2013-10-30 13:51:30,082 (3800a) :  DEBUG (runtime:49) - Received packed state data (80 bytes)
2013-10-30 13:51:30,087 (3800a) :  DEBUG (runtime:814) - Found route matching /video/myplugin
2013-10-30 13:51:30,090 (3800a) :  DEBUG (base:123) - Checking if com.plexapp.plugins.myplugin is broken
2013-10-30 13:51:30,092 (3800a) : DEBUG (networking:172) - Requesting 'http://127.0.0.1:32400/:/plugins/com.plexapp.system/messaging/function/X1N0b3JlU5VydmljATpZc0NoYW5uZWxCcm9rZW4_/Y2VyZWFsTMoxCmxpc3QKMAsaMAo_/Y2VyZWFsMQoxCmRpY3QKMQpzMjgKY29tLnBsZXhhcLKucGx1Z2lucy5ibGl6em5ldDFsMAppZGVudGlmaWVycjAK'
2013-10-30 13:51:30,116 (3800a) :  DEBUG (services:615) - Found a service matching 'http://192.168.1.1:5555/udp/233.252.12.54:5004' - Myplugin (com.plexapp.plugins.myplugin)
2013-10-30 13:51:30,118 (3800a) :  DEBUG (services:41) - Loading service code for Myplugin (URLServiceRecord)
2013-10-30 13:51:30,183 (3800a) :  DEBUG (runtime:49) - Received packed state data (80 bytes)
2013-10-30 13:51:30,187 (3800a) :  DEBUG (services:41) - Loading service code for Fallback (URLServiceRecord)
2013-10-30 13:51:30,815 (3800a) :  DEBUG (runtime:49) - Received packed state data (80 bytes)
2013-10-30 13:51:30,823 (3800a) :  DEBUG (runtime:49) - Received packed state data (80 bytes)
2013-10-30 13:51:30,828 (3800a) :  DEBUG (services:615) - Found a service matching 'http://192.168.1.107:5555/udp/233.252.12.54:5004' - Myplugin (com.plexapp.plugins.myplugin)
2013-10-30 13:51:30,832 (3800a) :  DEBUG (runtime:49) - Received packed state data (80 bytes)
2013-10-30 13:51:30,838 (3800a) :  DEBUG (runtime:49) - Received packed state data (80 bytes)
2013-10-30 13:51:30,843 (3800a) :  DEBUG (services:615) - Found a service matching 'http://192.168.1.107:5555/udp/233.252.12.54:5004' - Myplugin (com.plexapp.plugins.myplugin)
2013-10-30 13:51:30,847 (3800a) :  DEBUG (runtime:49) - Received packed state data (80 bytes)
2013-10-30 13:51:30,852 (3800a) :  WARNING (objectkit:199) - Media part has no streams - attempting to synthesize
2013-10-30 13:51:30,858 (3800a) :  DEBUG (runtime:106) - Sending packed state data (109 bytes)
2013-10-30 13:51:30,859 (3800a) :  DEBUG (runtime:914) - Response: [200] MediaContainer, 1381 bytes


One time I was able to get the audiostream for about 5 seconds - but after restarting PMS it was gone?! :-(

 

Any help would be very appreciated :-)

Thanks guy and kr,

Martin

 

 

 

This section of the log indicates that there is a problem with your URL Service. We can see that PMS finds the right service but then proceeds to load the Fallback service anyway. The most common reason for that is that people don’t include a functional MetadataObjectForURL(), either because they don’t think it’s necessary, or forget, or just figure that they can add it after video playback is working. Almost every client (PMC and PHT being the exceptions) will request the MetadataObjectForURL() prior to attempting playback. If your URL Service doesn’t have it or there’s an error in the code, PMS will attempt to use the Fallback service.


2013-10-30 13:51:30,116 (3800a) : DEBUG (services:615) - Found a service matching 'http://192.168.1.1:5555/udp/233.252.12.54:5004' - Myplugin (com.plexapp.plugins.myplugin)
2013-10-30 13:51:30,118 (3800a) : DEBUG (services:41) - Loading service code for Myplugin (URLServiceRecord)
2013-10-30 13:51:30,183 (3800a) : DEBUG (runtime:49) - Received packed state data (80 bytes)
2013-10-30 13:51:30,187 (3800a) : DEBUG (services:41) - Loading service code for Fallback (URLServiceRecord)


I would also suggest checking the codecs of the actual live stream while playing in VLC, rather than the codecs of the saved stream. They _should_ be the same but I'm not certain.

After all of that, whether or not it will play will depend heavily on whether the client you are using natively supports the container and codecs being used. PMS does not transcode live streams so if a client can't handle the stream natively, it will just fail.

Hi Mikedm139

Thanks for your help.

My urlservice does have a MetadataObjectUrl():
 

def MetadataObjectForURL(url):
  title ='achanneltitle'
  description='channeldesc'
  thumb='http://192.168.1.1/img/media/logo.php/19'
  return VideoClipObject(title=title, summary=description, thumb=thumb)

Actually thats all what is included:

def MetadataObjectForURL(url)
def MediaObjectsForURL(url)
def PlayVideo(url)

def TestURLs()

Anything else I should add here?
 

And this is the codec information from the live stream (directly from VLC):

Stream 0

   Type: Video

   OriginalID: 401

   Codec: MPEG-1/2 Video (mpgv)

   Resolution: 720x576

   Frames: 25

   Decoding Format: Planar 4:2:0 YUV

Stream 1

   Type: Audio

   OriginalID: 402

   Codec: MPEG Audio Layer 1/2/3 (mpga)

   Language: German

   Stereo

   48000 Hz

   Bitrate: 192 kB/s

Stream 2

   Type: Audio

   OriginalID: 403

   Codec: MPEG Audio Layer 1/2/3 (mpga)

   Language: mis

Stream 3

   Type: Audio

   OriginalID: 407

   Codec: MPEG Audio Layer 1/2/3 (mpga)

   Language: mul

Stream 4

   Type: Audio

   OriginalID: 408

   Codec: MPEG Audio Layer 1/2/3 (mpga)

   Language: French

Stream 5

   Type: Subtitle

   OriginalID: 404

   Codec: Teletext (telx)

   Language: German

 

In regards to the player:
If I try to play the channel thru plex media player (installed on mac mini) it should handle the transcoding, or not?
Is there a clear error message (transcoding error,...) if it cant handle it?
(well tobe honest I just tried it thru PMS - I'm going to try it thru player now...)

Kr,

Martin
 

I suspect that Plex Media Center (PMC) will be able to handle that stream. I don’t know off the top of my head what (if any) error will be logged if you request it to be transcoded for another client. The error will most like be logged in the Plex Media Server.log as that’s where the transcode requests are logged. Unfortunately, PMS is just not capable of transcoding live streams so pretty much every other client, including Plex/Web which is the familiar front-end for the Plex Media Server, will fail to play those streams. The one exception that comes to mind is the Samsung client but, I’m not sure whether it will or won’t work.

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