Jump to content

Direct play of Nextpvr live tv


crazybbs

Recommended Posts

Hi,

 

I posted this on emby theater beta forum and would like to know if @@Sven , you could do anything to resolve the issue of direct playing live tv

 

 

 

 I analyzed the logs to find a way to make nextpvr live tv to direct play  and I saw in the logs

 

2016-02-03 20:35:15.4202 Info HttpServer: HTTP Response 422 to 192.168.51.3. Time: 2648ms (slow). http://192.168.51.3:...=90&accept=webp
2016-02-03 20:35:15.4202 Info HttpServer: HTTP POST http://192.168.51.3:...tartTimeTicks=0. UserAgent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) EmbyTheater/1.0.40 Chrome/47.0.2526.110 Electron/0.36.7 Safari/537.36
2016-02-03 20:35:15.4202 Debug LiveTvMediaSourceProvider: MediaSources: [{"Protocol":"Http","Id":"6e03ce330e5073c0ca6efe4f5413676d","Path":"http://192.168.51.3:...ault","Name":"4TVA","ReadAtNativeFramerate":false,"SupportsTranscoding":true,"SupportsDirectStream":true,"SupportsDirectPlay":true,"RequiresOpening":true,"OpenToken":"LiveTvChannel_6e03ce330e5073c0ca6efe4f5413676d_6e03ce330e5073c0ca6efe4f5413676d","RequiresClosing":false,"BufferMs":1500,"MediaStreams":[],"PlayableStreamFileNames":[],"Formats":[],"RequiredHttpHeaders":{}}]
2016-02-03 20:35:15.4202 Info App: Bitrate exceeds DirectPlay limit
2016-02-03 20:35:15.4202 Info App: Bitrate exceeds DirectPlay limit
2016-02-03 20:35:15.4202 Info App: Profile: Unknown Profile, Path: http://192.168.51.3:8096, isEligibleForDirectPlay: False, isEligibleForDirectStream: False
2016-02-03 20:35:15.4202 Info App: Bitrate exceeds DirectPlay limit
2016-02-03 20:35:15.4202 Info App: Bitrate exceeds DirectPlay limit
2016-02-03 20:35:15.4202 Info App: Profile: Unknown Profile, Path: http://192.168.51.3:8096, isEligibleForDirectPlay: False, isEligibleForDirectStream: False
2016-02-03 20:35:15.4202 Info HttpServer: HTTP Response 200 to 192.168.51.3. Time: 4ms. http://192.168.51.3:...tartTimeTicks=0
2016-02-03 20:35:15.4374 Info HttpServer: HTTP POST http://192.168.51.3:...409aae0e40b0958. UserAgent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) EmbyTheater/1.0.40 Chrome/47.0.2526.110 Electron/0.36.7 Safari/537.36
2016-02-03 20:35:15.4374 Info App: Opening channel stream from Next Pvr, external channel Id: 9564
2016-02-03 20:35:15.4374 Info App: [NextPvr] Start ChannelStream
2016-02-03 20:35:15.4374 Info App: [NextPvr] Streaming http://192.168.51.3:...64&client=MB3.4
2016-02-03 20:35:15.4374 Info App: Live stream info: {"Protocol":"Http","Id":"4","Path":"http://192.168.51.3:...ttpHeaders":{}}
2016-02-03 20:35:15.4374 Debug MediaSourceManager: Live stream opened: {"Protocol":"Http","Id":"4","Path":"http://192.168.51.3:...ttpHeaders":{}}
2016-02-03 20:35:15.4374 Info App: Profile: Unknown Profile, Path: http://192.168.51.3:...64&client=MB3.4, isEligibleForDirectPlay: True, isEligibleForDirectStream: True
2016-02-03 20:35:15.4374 Info App: Profile: Unknown Profile, No direct play profiles found for Path: http://192.168.51.3:...64&client=MB3.4
2016-02-03 20:35:15.4374 Info App: Profile: Unknown Profile, Path: http://192.168.51.3:...64&client=MB3.4, isEligibleForDirectPlay: True, isEligibleForDirectStream: True
2016-02-03 20:35:15.4374 Info App: Profile: Unknown Profile, No direct play profiles found for Path: http://192.168.51.3:...64&client=MB3.4
2016-02-03 20:35:15.4374 Info App: Profile: Unknown Profile, Path: http://192.168.51.3:...64&client=MB3.4, isEligibleForDirectPlay: True, isEligibleForDirectStream: True
2016-02-03 20:35:15.4374 Info App: Profile: Unknown Profile, No direct play profiles found for Path: http://192.168.51.3:...64&client=MB3.4
2016-02-03 20:35:15.4374 Info HttpServer: HTTP Response 200 to 192.168.51.3. Time: 3ms. http://192.168.51.3:...409aae0e40b0958
2016-02-03 20:35:15.7753 Info HttpClient: HttpClientManager GET: http://192.168.51.3:.../event/26271754

 

Do you know why it says Bitrate exceeds DirectPlay limit , I tried with bitrate to auto and to max 50MBPS and still have the same log ,

 

do you think it's a plugin problem or server?

 

Thank you for your help

  • Like 1
Link to post
Share on other sites

the plugin is not supplying a bitrate, among other data. therefore the apps have no idea if they can handle it directly or not

Link to post
Share on other sites

the plugin is not supplying a bitrate, among other data. therefore the apps have no idea if they can handle it directly or not

 

Where should it be set? And what should be the value?

Link to post
Share on other sites

We don't know information about the stream until you've started it (ie when we get to look at the data flowing by). Is that too late?

 

Several attributes about streams can change on the fly, so NextPVR monitors it continually while it's playing live tv etc.

Edited by sub3
Link to post
Share on other sites

@@Sven

 

I would like to test with an arbitry value based on my analyse of a hd channel stream, its always 4-4.5 MBS

 

if I put a 5MBPS bitrate it should work just for a test?

 

I downloaded the sourcecode and want to put this value , Do I put it in bytes , kb or mpbs??

Link to post
Share on other sites

@@Sven @@Luke, what information does the backend need to supply for this?

 

Well it needs to know at the time of opening the stream. If you truly don't have that information at that point in time, then it's best to just leave it as-is. I could add back the server probing that we used to have but it will create longer startup times. Here's an example of the data that the hdhomerun provider supplies:

 

https://github.com/MediaBrowser/Emby/blob/master/MediaBrowser.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunHost.cs#L234

 

You can see they're just estimates. The purpose is really just to help the client app determine if it can handle the codecs and bitrates. I think one day we'll probably buffer the stream server side in order to improve recording capabilities. At that point we'll probably get exact media info, but until then that will suffice.

Link to post
Share on other sites

Well it needs to know at the time of opening the stream. If you truly don't have that information at that point in time, then it's best to just leave it as-is. I could add back the server probing that we used to have but it will create longer startup times. Here's an example of the data that the hdhomerun provider supplies:

 

https://github.com/MediaBrowser/Emby/blob/master/MediaBrowser.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunHost.cs#L234

 

You can see they're just estimates. The purpose is really just to help the client app determine if it can handle the codecs and bitrates. I think one day we'll probably buffer the stream server side in order to improve recording capabilities. At that point we'll probably get exact media info, but until then that will suffice.

 

Maybe i can try to use those values, no?

Link to post
Share on other sites

I tried to put some value in bitrate  but still got the same errors

 

@@Sven do someone know where this log come from I can't find it in LiveTVservices.cs

 

2016-02-08 11:47:17.2199 Debug LiveTvMediaSourceProvider: MediaSources: [{"Protocol":"Http","Id":"5e2e7052b439dd51ab2beb7f5282834a","Path":"http://192.168.51.3:8096","Type":"Default","Name":"D-HD","ReadAtNativeFramerate":false,"SupportsTranscoding":true,"SupportsDirectStream":true,"SupportsDirectPlay":true,"RequiresOpening":true,"OpenToken":"LiveTvChannel_5e2e7052b439dd51ab2beb7f5282834a_5e2e7052b439dd51ab2beb7f5282834a","RequiresClosing":false,"BufferMs":1500,"MediaStreams":[],"PlayableStreamFileNames":[],"Formats":[],"RequiredHttpHeaders":{}}]

 

@@Luke the logs show 2 problems one with bitrate exceeds and one with unknown profil, As you can see in the logs after the bitrate exceed,

the starting stream send bitrate but still answer unknown profil??

 

Thank you for you help

server-63590528760.txt

Edited by crazybbs
Link to post
Share on other sites

For starters, use the sample link I gave you and try to mimic that. Then once you've mocked something up, then you can worry about getting it accurate. Without having a test setup for each of these tv plugins these questions can be difficult to visualize so you need to be wiling to experiment a little.

Link to post
Share on other sites

@@Luke I already compared with the Hdhomerun source code and inserted some new settings to test but I still don't know why it says unknown profil , where do I can see an emby theater profil or nextpvr one???

Link to post
Share on other sites

@@Luke I found this in MediaBrowserTheaterProfile.cs

 

new DirectPlayProfile { Container = "avi,mkv,ts,mp4,mov,m4v,asf,wmv,mpg,mpeg,flv,3gp,mpegts,m2ts,vob,webm", Type = DlnaProfileType.Video

},

 

 

is it because nextpvr send an url without container that it says unknown profile??

 

I dont find MediaBrowserTheaterProfile.dll on my emby theater folder , is it because it's hosted online?

Link to post
Share on other sites

Well, Can someone post me a logs (Server, Emby theater ) using Emby tv Homerun tuner watching live tv with emby theater, so I can see what informations it send

 

Thank you,

Link to post
Share on other sites

Just an update , I finally found a way to direct play in Emby theater by modifiing parameters copying from emby tv plugin and it's working.

 

but the problem is i'm not sure if it's doable for everyone.

 

I hardcoded video codec and sound codec in the plugin because i'm using hauppauge hdpvr and I know that it's always pushing h264 and Ac3.

 

@@Sven may be put optionnal in plugin config??

 

this is what I modified in livetvservices.cs

 

        public async Task<MediaSourceInfo> GetChannelStream(string channelOid, string mediaSourceId, CancellationToken cancellationToken)
        {
            _logger.Info("[NextPvr] Start ChannelStream");
            var config = Plugin.Instance.Configuration;
            var baseUrl = Plugin.Instance.Configuration.WebServiceUrl;
            _liveStreams++;

            if (config.TimeShift)
            {
                var options = new HttpRequestOptions
                {
                    CancellationToken = cancellationToken,
                    Url = string.Format("{0}/public/VLCService/Dump/StreamByChannel/OID/{1}", baseUrl, channelOid)
                };

                using (var stream = await _httpClient.Get(options).ConfigureAwait(false))
                {
                    var vlcObj = new VLCResponse().GetVLCResponse(stream, _jsonSerializer, _logger);
                    _logger.Debug(vlcObj.StreamLocation);

                    while (!File.Exists(vlcObj.StreamLocation))
                    {
                        await Task.Delay(200).ConfigureAwait(false);
                    }
                    await Task.Delay(20000).ConfigureAwait(false);
                    _logger.Info("[NextPvr] Finishing wait");
                    _heartBeat.Add(_liveStreams, vlcObj.ProcessId);
                    return new MediaSourceInfo
                    {
                        Id = _liveStreams.ToString(CultureInfo.InvariantCulture),
                        Path = vlcObj.StreamLocation,
                        Protocol = MediaProtocol.File,
                        MediaStreams = new List<MediaStream>
                        {
                            new MediaStream
                            {
                                Type = MediaStreamType.Video,
                                IsInterlaced = true,
                                BitRate = 5000000,
                                Codec = "h264",
                                // Set the index to -1 because we don't know the exact index of the video stream within the container
                                Index = -1
                            },
                            new MediaStream
                            {
                                Type = MediaStreamType.Audio,
                                IsInterlaced = true,
                                BitRate = 192000,
                                Codec = "ac3",
                                // Set the index to -1 because we don't know the exact index of the audio stream within the container
                                Index = -1
                            }
                        },
                        RequiresOpening = false,
                        RequiresClosing = false,
                        BufferMs = 0,
                        Container = "ts",
                        SupportsDirectPlay = true,
                        SupportsDirectStream = true,
                        SupportsTranscoding = true
                    };
                }
            }

            string streamUrl = string.Format("{0}/live?channeloid={1}&client=MB3.{2}", baseUrl, channelOid, _liveStreams.ToString());
            _logger.Info("[NextPvr] Streaming " + streamUrl);
            return new MediaSourceInfo
            {
                Id = _liveStreams.ToString(CultureInfo.InvariantCulture),
                Path = streamUrl,
                Protocol = MediaProtocol.Http,
                MediaStreams = new List<MediaStream>
                        {
                            new MediaStream
                            {
                                Type = MediaStreamType.Video,
                                IsInterlaced = true,
                                BitRate = 5000000,
                                Codec = "h264",
                                // Set the index to -1 because we don't know the exact index of the video stream within the container
                                Index = -1,
                            },
                            new MediaStream
                            {
                                Type = MediaStreamType.Audio,
                                IsInterlaced = true,
                                BitRate = 192000,
                                Codec = "ac3",
                                // Set the index to -1 because we don't know the exact index of the audio stream within the container
                                Index = -1
                            }
                        },
                RequiresOpening = false,
                RequiresClosing = false,
                BufferMs = 0,
                Container = "ts",
                SupportsDirectPlay = true,
                SupportsDirectStream = true,
                SupportsTranscoding = true
            };
        }


 

I didn't touch recording because i'm not using it but should do the same in it.

 

@@Luke I had to remove wasapi audio renderer, if not directshow crashed playing, do you know why ? I put it in default and everything is working.

Edited by crazybbs
Link to post
Share on other sites

It's working for me. But there must be a method to get the profile that they are using in the Interface. But i don't think that's possible for the moment in the ILiveTVService.

Link to post
Share on other sites
pünktchen

It's working for me. But there must be a method to get the profile that they are using in the Interface. But i don't think that's possible for the moment in the ILiveTVService.

What about my pm?
Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...