NextPVR Forums
  • ______
  • Home
  • New Posts
  • Wiki
  • Members
  • Help
  • Search
  • Register
  • Login
  • Home
  • Wiki
  • Members
  • Help
  • Search
NextPVR Forums Public Developers v
« Previous 1 … 3 4 5 6 7 … 93 Next »
Transcoding service

 
  • 0 Vote(s) - 0 Average
Transcoding service
mvallevand
Offline

Posting Freak

Ontario Canada
Posts: 52,940
Threads: 956
Joined: May 2006
#1
2016-08-23, 09:14 PM (This post was last modified: 2016-08-23, 09:58 PM by mvallevand.)
I am playing around with the transcoding service and see this

Code:
if (getParameterByName("channel_id", null) != null) {
        $("#info").text("Requesting stream for channel. Standby...");
        url = finalizeURL(baseNPVRURL + 'services/service?method=channel.transcode.initiate&channel_id=' + getParameterByName("channel_id", null) + '&profile=' + profile + '&random=' + Math.random());
        statusCheckURL = finalizeURL(baseNPVRURL + 'services/service?method=channel.transcode.status&format=json');        
        streamURL = finalizeURL(baseNPVRURL + 'services/service?method=channel.transcode.m3u8&random=' + Math.random());
        leaseURL = finalizeURL(baseNPVRURL + 'services/service?method=channel.transcode.lease&format=json');
      } else
      // handle recording playback
        if (getParameterByName("recording_id", null) != null) {
        $("#info").text("Requesting stream for recording");
        url = finalizeURL(baseNPVRURL + 'services/service?method=recording.transcode.initiate&recording_id=' + getParameterByName("recording_id", null) + '&profile=' + profile + '&random=' + Math.random());
        statusCheckURL = finalizeURL(baseNPVRURL + 'services/service?method=recording.transcode.status&format=json');
        streamURL = finalizeURL(baseNPVRURL + 'services/service?method=recording.transcode.m3u8&random=' + Math.random());
        leaseURL = finalizeURL(baseNPVRURL + 'services/service?method=recording.transcode.lease&format=json');
      }

I can initiate transcoding and play but I don't see how to stop transcoding without manually killing ffmpeg. I though maybe if I didn't lease it would die. but it has been buffering for 5 mnutes with no reading the status is this

Code:
{

    "status": "Buffering stream. Please Wait... (100%)",
    "final": true,
    "percentage": 100

}

Thanks,

Martin

EDIT it looks like I have to issue one lease and then it will fail in 5 or 6 seconds.

Martin
sub
Online

Administrator

NextPVR HQ, New Zealand
Posts: 106,708
Threads: 767
Joined: Nov 2003
#2
2016-08-23, 10:03 PM
You can do method=channel.transcode.stop or method=recording.transcode.stop

With hls there isn't a permanent connection to the server, to tell if the player is still there and wanting the stream, and if the player is paused it may not be asking for segments (for an indication the transcode is still needed). Ideally you should ideally call method=channel.transcode.lease or method=recording.transcode.lease every few seconds to tell the application you still require the stream. If you've called these at least once, then the application will monitor the session and auto kill the transcode and stream if the lease renewal requests stop coming.
mvallevand
Offline

Posting Freak

Ontario Canada
Posts: 52,940
Threads: 956
Joined: May 2006
#3
2016-08-23, 10:08 PM
Thanks sub, I will use the lease but stop it if I can.

What profiles are available? I'd like my h264 streams to be remuxed not transcoded.

Martin
sub
Online

Administrator

NextPVR HQ, New Zealand
Posts: 106,708
Threads: 767
Joined: Nov 2003
#4
2016-08-23, 10:16 PM
mvallevand Wrote:What profiles are available?
At this stage, profiles strings are two parts <res>-<bitrate>, where <res> is 1080p/720p/480p/360p, and the <bitrate> is any user defined bitrate ending in mbps or kbps.

In future we may also ended up with additional custom defined profiles that can be defined in config.xml, which the client app can query, but for now it's as above.

Quote:I'd like my h264 streams to be remuxed not transcoded.
At the moment the h.264 source material is re-transcoded, but I'm hoping to remove that requirement in the near future. I found the iPhone didn't like some of the H.264 streams out of the HDPVR2, so re-transcoding of H.264 video might still be required long term - more experimenting required.
mvallevand
Offline

Posting Freak

Ontario Canada
Posts: 52,940
Threads: 956
Joined: May 2006
#5
2016-08-24, 01:48 AM
Thanks, again and I think I've got it just wondering if I can use &sid instead of &random.

Martin
sub
Online

Administrator

NextPVR HQ, New Zealand
Posts: 106,708
Threads: 767
Joined: Nov 2003
#6
2016-08-24, 01:52 AM
The &random is just something client side to force the browser to not use a cached response. The server doesn't look for it, but doesn't care that it's there.
mvallevand
Offline

Posting Freak

Ontario Canada
Posts: 52,940
Threads: 956
Joined: May 2006
#7
2016-08-24, 03:10 PM (This post was last modified: 2016-08-24, 03:38 PM by mvallevand.)
Ok I have it working with some notes

1) channel.transcode.status

- almost always call times out the first GET doesn't reply so not great for polling log attached

2) channel.transcode.lease

- use note it can take 1-2 or more seconds for the lease response so the client wait needs to start before the call. However lease and player seem to share the same thread and somtimes it takes more then the 5 second lease time to process the call (admittedly my backend is slow too slow for HD)

3) channel.transcode.status&format=json&sid=

- if the sid isn't found the arg parser returns xml I understand why but it was confusing at first

4) logs don't get deleted from web\temp because they are locked by NRecord

5) transcoding assumes wide screen

Martin
sub
Online

Administrator

NextPVR HQ, New Zealand
Posts: 106,708
Threads: 767
Joined: Nov 2003
#8
2016-08-24, 09:38 PM
mvallevand Wrote:Ok I have it working with some notes

1) channel.transcode.status

- almost always call times out the first GET doesn't reply so not great for polling log attached
In the log, it looks like you've called it before you've initiated the transcode.

Quote:2) channel.transcode.lease

- use note it can take 1-2 or more seconds for the lease response so the client wait needs to start before the call. However lease and player seem to share the same thread and somtimes it takes more then the 5 second lease time to process the call (admittedly my backend is slow too slow for HD)
It's pretty much instance here, but I have a reasonably fast backend. You probably want to make it an async call, happening on a separate thread.

Quote:3) channel.transcode.status&format=json&sid=

- if the sid isn't found the arg parser returns xml I understand why but it was confusing at first
Ok, I'll fix.
mvallevand
Offline

Posting Freak

Ontario Canada
Posts: 52,940
Threads: 956
Joined: May 2006
#9
2016-08-24, 10:11 PM
sub Wrote:In the log, it looks like you've called it before you've initiated the transcode..

I use &sid= for my security model. I was hoping that status was global because, I don't want to kill another running transcode and my machines couldn't handle too.

Quote:It's pretty much instance here, but I have a reasonably fast backend. You probably want to make it an async call, happening on a separate thread.

The blocking seems to be at the server end this lease was sent at 11:17:30

Code:
2016-08-24 11:17:35.597    [DEBUG][42]    Got Web Request (172.16.3.62): /services/services    method=channel.transcode.lease&sid=1b50fc72bbd14e48894f9019a13c0e13
2016-08-24 11:17:35.597    [DEBUG][42]    method=channel.transcode.lease
2016-08-24 11:17:35.598    [DEBUG][42]    parameters:
2016-08-24 11:17:35.598    [DEBUG][42]       method: channel.transcode.lease
2016-08-24 11:17:35.598    [DEBUG][42]       sid: 1b50fc72bbd14e48894f9019a13c0e13
2016-08-24 11:17:35.598    [DEBUG][42]       client_ip: 172.16.3.62
2016-08-24 11:17:35.598    [DEBUG][42]       host_callback: 172.16.3.2:8866
2016-08-24 11:17:35.598    [DEBUG][42]       physical_path: C:\Users\Public\NPVR\web\
2016-08-24 11:17:35.598    [DEBUG][42]       user_agent: Python-urllib/2.7
2016-08-24 11:17:35.598    [DEBUG][42]       range:
2016-08-24 11:17:35.598    [DEBUG][42]       requested_path: /services/services
2016-08-24 11:17:35.598    [DEBUG][42]       verb: GET
2016-08-24 11:17:35.598    [DEBUG][42]    <?xml version="1.0" encoding="utf-8" ?>
<rsp stat="ok">
</rsp>

after the lease had expired

2016-08-24 11:17:35.003 [DEBUG][39] Lease expired. Stopping transcode


Martin
mvallevand
Offline

Posting Freak

Ontario Canada
Posts: 52,940
Threads: 956
Joined: May 2006
#10
2016-08-24, 11:56 PM
Further to the lease issue it happened again so I thought I'd send the web log for you to look at. Kodi player just stalls be the .lease and the .m3u8 continue because no error is generated even though transcoding has stoppeid.

In Kodi

Code:
19:23:31 T:12376   DEBUG: ## Heartbeat
19:23:31 T:12376   DEBUG: http://172.16.3.2:8866/services/services?method=channel.transcode.lease&sid=c25d129c7c614e66950847f746111b99
19:23:32 T:5844   DEBUG: Thread JobWorker 5844 terminating (autodelete)
19:23:33 T:6644   DEBUG: CPullupCorrection: detected pattern of length 1: 33366.67, frameduration: 33366.666667
19:23:35 T:16644  NOTICE: CVideoPlayerAudio::Process - stream stalled
19:23:35 T:6644    INFO: CVideoPlayerVideo - Stillframe detected, switching to forced 29.970030 fps
19:23:35 T:6644   DEBUG: CPullupCorrection: pattern lost on diff 166833.333333, number of losses 1
19:23:37 T:12376   DEBUG: <?xml version="1.0" encoding="utf-8" ?>

                                            <rsp stat="ok">

                                            </rsp>
19:23:37 T:12376   DEBUG: 2016-08-24 19:23:36.739000 <- note this is the calculated time to send the next heartbeat but the reply was too long
19:23:38 T:12376   DEBUG: ## Heartbeat
19:23:38 T:12376   DEBUG: http://172.16.3.2:8866/services/services?method=channel.transcode.lease&sid=c25d129c7c614e66950847f746111b99

Martin
« Next Oldest | Next Newest »

Users browsing this thread: 1 Guest(s)

Pages (3): 1 2 3 Next »


Possibly Related Threads…
Thread Author Replies Views Last Post
  is there a service?method which returns listings for multiple channels? reven 16 6,997 2022-04-11, 04:30 PM
Last Post: mandai
  NextPVR "Service" Backend? jcole998 5 4,807 2018-05-24, 01:17 PM
Last Post: jcole998
  Time to make Touch web Service less experimental fred250 106 28,276 2014-06-15, 09:13 PM
Last Post: fred250
  New web service clarification needed bgowland 6 3,236 2013-10-19, 02:36 AM
Last Post: bgowland
  [REQ] Additional web service API calls reven 26 8,216 2013-08-31, 10:08 PM
Last Post: mvallevand
  getting recurring recordings from service?method API? reven 2 1,955 2013-08-03, 10:50 PM
Last Post: reven
  need some doc around service?methods reven 12 4,570 2013-07-25, 11:00 PM
Last Post: reven
  On-the-fly transcoding for streaming recordings / videos bgowland 6 4,011 2012-06-03, 03:10 AM
Last Post: bgowland
  Creating a Windows service McBainUK 8 3,413 2011-03-30, 03:29 AM
Last Post: mvallevand
  GB-PVR rec. service locks my classlib bgowland 6 2,593 2009-02-12, 11:32 PM
Last Post: sub

  • View a Printable Version
  • Subscribe to this thread
Forum Jump:

© Designed by D&D, modified by NextPVR - Powered by MyBB

Linear Mode
Threaded Mode