Channel to View .TS files - need to transcode

Transcoding of “live” streams is not currently supported no matter what format. That being said, your pre-recorded TS streams “should” be able to be transcoded by PMS.

Transcoding of "live" streams is not currently supported no matter what format. That being said, your pre-recorded TS streams "should" be able to be transcoded by PMS.

It's not a live stream...It is pre-recorded.

Do you have a sample file that we can mess with?

Also, can you post the response from a curl --head request to one of your urls?

Hey all!

I have not read the entire thread, but wanted to add that .ts files are usually not the same as what is being used in HTTP Live Streaming. .ts files are usually MPEG2, whereas HLS is MPEG4/H.264.

Do you have a sample file that we can mess with?

So I've cut 2 20mb chunks off the file:

https://app.box.com/s/qnonsszyaxxjhk67o32b

The THomas & Friends one.

Hey all!

I have not read the entire thread, but wanted to add that .ts files are usually not the same as what is being used in HTTP Live Streaming. .ts files are usually MPEG2, whereas HLS is MPEG4/H.264.

These ones are h.264 with AAC or Dolby digital sound.

BTW I'm not trying (at the moment) to live stream a file - the file is static, prerecorded TS file.   I would like to in the future do a live stream of something recording at the moment - but understand that may be a different issue.

Seems like it's H264-MP4 video with AAC audio...

Also, can you post the response from a curl --head request to one of your urls?

david@Bilbo:~/Documents$ curl --head http://pvr.lan:8866/live?recording=18121
HTTP/1.1 200 OK
Server: NextPVR
Connection: Close
Content-Length: 278710752
Content-Type: video/MP2T

 

Try hitting (with curl or browser):

http://localhost:32400/system/:/services/url/lookup?url=http%3A//pvr.lan%3A8866/live%3Frecording%3D18121

Then check the com.plexapp.system.log for errors.

Try hitting (with curl or browser):

http://localhost:32400/system/:/services/url/lookup?url=http%3A//pvr.lan%3A8866/live%3Frecording%3D18121

Then check the com.plexapp.system.log for errors.

2013-08-30 11:40:39,802 (88c) :  DEBUG (runtime:717) - Handling request GET /system/:/services/url/lookup?url=http%3A//pvr.lan%3A8866/live%3Frecording%3D18121
2013-08-30 11:40:39,806 (88c) :  DEBUG (runtime:814) - Found route matching /system/:/services/url/lookup
2013-08-30 11:40:39,806 (88c) :  DEBUG (services:23) - Looking up URL 'http://pvr.lan:8866/live?recording=18121'
2013-08-30 11:40:39,806 (88c) :  DEBUG (services:615) - Found a service matching 'http://pvr.lan:8866/live?recording=18121' - NextPVR (com.dcSoftware.plexapp.nextpvr)
2013-08-30 11:40:39,812 (88c) :  DEBUG (services:41) - Loading service code for NextPVR (URLServiceRecord)
2013-08-30 11:40:39,832 (88c) :  DEBUG (networking:172) - Requesting 'http://resources-cdn.plexapp.com/hashes.json'
2013-08-30 11:40:40,647 (88c) :  DEBUG (services:615) - Found a service matching 'http://pvr.lan:8866/live?recording=18121' - NextPVR (com.dcSoftware.plexapp.nextpvr)
2013-08-30 11:40:40,647 (88c) :  DEBUG (services:41) - Loading service code for Fallback (URLServiceRecord)
2013-08-30 11:40:40,826 (88c) :  DEBUG (networking:233) - Fetching HTTP headers for 'http://pvr.lan:8866/live?recording=18121'
2013-08-30 11:40:40,832 (88c) :  INFO (logkit:16) - Length: 278710752  Type: video/MP2T
2013-08-30 11:40:40,832 (88c) :  INFO (logkit:16) - Content length for unknown type video/MP2T is invalid - aborting
2013-08-30 11:40:40,832 (88c) :  DEBUG (services:602) - No service found for URL 'ipad:http://pvr.lan:8866/live?recording=18121'
2013-08-30 11:40:40,836 (88c) :  DEBUG (services:617) - No matching services found for 'ipad:http://pvr.lan:8866/live?recording=18121'
2013-08-30 11:40:40,836 (88c) :  DEBUG (services:602) - No service found for URL 'ipad:http://pvr.lan:8866/live?recording=18121'
2013-08-30 11:40:40,836 (88c) :  DEBUG (services:617) - No matching services found for 'ipad:http://pvr.lan:8866/live?recording=18121'
2013-08-30 11:40:40,836 (88c) :  DEBUG (networking:233) - Fetching HTTP headers for 'http://pvr.lan:8866/live?recording=18121'
2013-08-30 11:40:40,861 (88c) :  INFO (logkit:16) - Length: 278710752  Type: video/MP2T
2013-08-30 11:40:40,861 (88c) :  INFO (logkit:16) - Content length for unknown type video/MP2T is invalid - aborting
2013-08-30 11:40:40,861 (88c) :  DEBUG (runtime:914) - Response: [404] NoneType, 0 bytes

Strange. It’s definitely failing in your URL Service but not throwing a related error. Do you have a MetadataObjectForURL() function in your URL Service?

Strange. It's definitely failing in your URL Service but not throwing a related error. Do you have a MetadataObjectForURL() function in your URL Service?

it's posted here

http://forums.plexapp.com/index.php/topic/79306-channel-for-ts-files-invalid-content-length-what-does-this-mean/#entry454573

That looks like no. Try adding one. Even something as simple as

def MetadataObjectForURL(url):
  return VideoClipObject(
    title = "test"
    )

Omg. Success!!!  Quality is garbage because it's over the internet.



 

So this method should work for all recorded content, ie static files.

Inflight recordings will most likely not work?

Correct. :smiley:

Hm just tried an in progress recording and it did actually work - I'll have to test more as not sure what will happen when it gets to the end of the time at start of playback (given the video will be getting larger).

But one question I have is with the MetadataObjectForURL - my videos already have a title when I set up the screen, and after playing they now take the title that's listed in the MetadataObjectForURL method.

How can I retain the title from before playback?

So I've managed to get a recorded video to work, and an in progress.   If I wanted to introduce a delay before the tried to access a stream (for live) where would I put it  is this something I could get my url service to do?

In progress and recorded the url is http://server:port/live&recording=recordingnumber

Live is http://server:port/live&channel=channelnumber

So basically just need to tell the difference between the two, and send the channel= one into a 2 - 5 second delay.  Did I see this as possible somewhere?

Hm just tried an in progress recording and it did actually work - I'll have to test more as not sure what will happen when it gets to the end of the time at start of playback (given the video will be getting larger).

But one question I have is with the MetadataObjectForURL - my videos already have a title when I set up the screen, and after playing they now take the title that's listed in the MetadataObjectForURL method.

How can I retain the title from before playback?

There are two ways to achieve this.

  1. Fully implement the MetadataObjectForURL() function in the URL Service to populate the title, etc based on the url provided. Yes, this may seem like a duplication of code used in the plugin but that's just the way it works and there are reasons for doing it this way. For examples, check out the Services.bundle. Here's the way it's done for RottenTomatoes.
  2. Remove the URL Service altogether and fold the code into the plugin directly. This method is generally not recommended for streaming content but since your plugin is accessing local LAN content it seems reasonable. If you're going to try this, it requires building in an extra callback layer as is done in the PlexPodcast channel, here. That example is specific to audio media but the basics are the same for video.

So I've managed to get a recorded video to work, and an in progress.   If I wanted to introduce a delay before the tried to access a stream (for live) where would I put it  is this something I could get my url service to do?

In progress and recorded the url is http://server:port/live&recording=recordingnumber

Live is http://server:port/live&channel=channelnumber

So basically just need to tell the difference between the two, and send the channel= one into a 2 - 5 second delay.  Did I see this as possible somewhere?

I don't believe it's possible to introduce a delay. You could throw in a "sleep" line prior to returning the actual video, but it will still just grab the live feed after the sleep rather than giving the buffered effect. I think you would have to make the plugin start a recording, then treat it as an in-progress recording.