Jump to content

Feature Request - Direct Play/Stream on a per file basis


DarkStaff

Recommended Posts

DarkStaff

I currently have a situation where some new files were encoded using Hi10p, which seems to have trouble decoding on my cuboxi-tv.  Any chance we could add to the context menu a "Direct Stream this Episode/Movie" or alternatively a "Direct Play this movie" depending on whether your global setting is set to Direct Play or Direct Stream.  Would be nice/useful to be able to direct play one or two files without having to change the global setting on the occasions it is necessary and let the emby server handle the transcoding instead of the cuboxi-tv.

 

Edit:

 

After reading into what each of the options does, what I would guess I am really asking for is a way to force Emby Server to transcode and serve the file on a one by one basis without having to sacrifice video quality, vs just direct play/direct streaming to Kodi.  So not so much the file source location but the method of delivery, as my Emby Server can handle transcoding the HI10P but cuboxi can not.

Edited by DarkStaff
Link to comment
Share on other sites

Vidman

I'm almost certain the emby for kodi already has an option for exactly this situation but as I don't use it and I am at work ATM I can't tell you exactly what it's called, basically you set it to what level your kodi device can handle and it will have emby transcode anything above, you probably need to be using addon, not native paths for it to work also

Edited by Vidman
Link to comment
Share on other sites

DarkStaff

I'm almost certain the emby for kodi already has an option for exactly this situation but as I don't use it and I am at work ATM I can't tell you exactly what it's called, basically you set it to what level your kodi device can handle and it will have emby transcode anything above, you probably need to be using addon, not native paths for it to work also

 

Surprisingly, it does not have this option.  The hack-ish way to do this is to set Emby for Kodi to HTTP instead of SMB, then downgrade the bitrate to the point that you force it to transcode.  In my case that means I have to take 720p videos and reduce the bitrate to 664k, which is blocky SD reminiscent of SNES graphics quality, and then Emby is forced to transcode.  Problems with this method are the significant reduction in picture quality, and it is a global change, so you would have to go into your settings and go from 664k bitrate to 100/1000Mbps bitrate any time you want to transcode a video.  It would be nice if there was a context menu option that could force a transcode within Emby without having to reduce the bitrate or quality on a case by case basis without global setting changes.

 

Also using Addon not native paths currently as well.  

Edited by DarkStaff
Link to comment
Share on other sites

Vidman

I'm almost certain the emby for kodi already has an option for exactly this situation but as I don't use it and I am at work ATM I can't tell you exactly what it's called, basically you set it to what level your kodi device can handle and it will have emby transcode anything above, you probably need to be using addon, not native paths for it to work also

OK I had a look and my bad the option is for H265 encoded media not Hi10p, perhaps Angelblue05 could extend it to hi10p also as I think she is an anime fan
Link to comment
Share on other sites

DarkStaff

You could potentially add something to the custom context menu the addon has to trigger playback for the current item using transcode, check out the code and have a play with the custom context menu builder addon bit of code, it might be easy to add.

 

Forked the code and working on it right now, running into a roadblock though.

 

OK I had a look and my bad the option is for H265 encoded media not Hi10p, perhaps Angelblue05 could extend it to hi10p also as I think she is an anime fan

 

 

Decided to take Vidman's approach with this and use a global setting for Hi10P, as a system that can't decode Hi10P will never be able to so why use a context menu every time.  Having looked at the code for how the H265 global setting is put into place, it seems pretty easy, except I am stumbling on one part.

and ("HEVC" in videotrack or "H265" in videotrack):

This second portion of the H265 if statement seems to help determine whether the video track meets the criteria for H265 if the setting it switched on.  Not sure if there are similar attributes in the videotrack for Hi10P as Kodi identifies Hi10P as h.264 MPEG/AVC just like any other h.264 codec.  

 

null_pointer, do you by chance know if it is on the kodi or the emby end that the videotrack info is chosen? If on the Emby end it looks like High 10 is the profile, so it can be identified, but I am not sure if that information is passed along to Kodi for identification of High 10.  If I can figure that out, I can get this tested and put in a pull request, as it is a pretty simple modification.  it Does look like the read_embyserver.py pulls the MediaSources info from Emby Server and potentially that would include the video codec and profile, but sadly I don't have a test environment to check that on.  if it does then i am assuming I could create a second variable videoprofile, similar to videotrack, to check the profile and codec as to whether they are "Main" or "High 10".

 

Edit: Proposed change would be:

videoprofile = self.item['MediaSources'][1]['Name']
transcodeHi10P = settings('transcodeHi10P')        
 
if transcodeHi10P == "true" and "H264" in videotrack and "High 10" in videoprofile:
      return False 

Only hold up is I don't have a test environment to get a full print out of MediaSources to confirm [1]['Name'] is the profile placement.

Edited by DarkStaff
Link to comment
Share on other sites

Angelblue05

Very simple for you to get what you need. In playutils.py line 21 add the following: self.logMsg(self.item)

 

Play the video Hi10p then check your Kodi log, you'll see what Emby reports your videotracks as.

 

 

Sent from my iPhone using Tapatalk

Link to comment
Share on other sites

DarkStaff

Very simple for you to get what you need. In playutils.py line 21 add the following: self.logMsg(self.item)

 

Play the video Hi10p then check your Kodi log, you'll see what Emby reports your videotracks as.

 

 

Sent from my iPhone using Tapatalk

 

Much appreciated, will get this into place and take a look

 

Adding the line you suggested threw an exception:

18:03:53 T:3952   ERROR: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
                                             - NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
                                            Error Type: <type 'exceptions.AttributeError'>
                                            Error Contents: PlayUtils instance has no attribute 'addonName'
                                            Traceback (most recent call last):
                                              File "C:\Users\XXXXXX\AppData\Roaming\Kodi\addons\plugin.video.emby.tvshows\default.py", line 40, in <module>
                                                entrypoint.doPlayback(itemid, dbid)
                                              File "C:\Users\XXXXXX\AppData\Roaming\Kodi\addons\plugin.video.emby\resources\lib\entrypoint.py", line 36, in doPlayback
                                                pbutils.PlaybackUtils(item).play(itemid, dbid)
                                              File "C:\Users\XXXXXX\AppData\Roaming\Kodi\addons\plugin.video.emby\resources\lib\playbackutils.py", line 59, in play
                                                playutils = putils.PlayUtils(item)
                                              File "C:\Users\XXXXXX\AppData\Roaming\Kodi\addons\plugin.video.emby\resources\lib\playutils.py", line 21, in __init__
                                                self.logMsg(self.item)
                                              File "C:\Users\XXXXXX\AppData\Roaming\Kodi\addons\plugin.video.emby\resources\lib\playutils.py", line 31, in logMsg
                                                utils.logMsg("%s %s" % (self.addonName, self.className), msg, lvl)
                                            AttributeError: PlayUtils instance has no attribute 'addonName'
                                            -->End of Python script error report<--

Update: Modifications completed and forced transcoding on Hi10P works. Put in pull request on the Git. Edited by DarkStaff
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...