MoojMidge / service.upnext

GNU General Public License v2.0
26 stars 5 forks source link

RPI4 - detector not making captures #24

Open pgranat opened 1 year ago

pgranat commented 1 year ago

Hi, thanks for cool add-on. I did some testing on RPI4 Kodi 20.2, upnext v2.0.27+dev.0 (2023-09-30)

It works flawlessly except detector. I play videos from my library and of course - detector starts. But the problem is IMHO in this part

https://github.com/MoojMidge/service.upnext/blob/f9694866bbb01b4ca338440d31e535681a67dd6e/resources/lib/detector.py#L696-L705

According to my log https://paste.kodi.tv/ajikuriruy.kodi it goes on endless loop trying to retry failed capture which never happens. This part over and over

[service.upnext] UpNextDetector -> Capture failed using 8kB data limit

After some digging i found >HERE< that specifically this part

https://github.com/MoojMidge/service.upnext/blob/f9694866bbb01b4ca338440d31e535681a67dd6e/resources/lib/detector.py#L696

Can return garbage results on RPI. That's why capture never happens, upnext is retrying until prompt 60s before movie ending appears.

Thanks for any tips

MoojMidge commented 1 year ago

Unfortunately you are probably using a video renderer that does not support the render capture interface exposed by Kodi. For a RPi4 I'm guessing that would be the DRMPrime renderer.

The reason why the capture loop exists is because even on a platform that does implement the render capture interface, the capture may not have been completed in time or the data may be incomplete, and so the plugin will try to capture again but with decreasing resolution.

This obviously will never work for a device that does not implement the render capture interface in the first place, but there is no easy way to detect this, so rather than whitelisting specific platforms, the detector functionality must instead be enabled/disabled as a user option. In your case it will need to be disabled.

pgranat commented 1 year ago

Thanks for your response. Indeed it's DRMPrime, i turned off detector functionality. The question (maybe you know) is whether capture will work someday and is treated as a bug or intentionally not implemented in DRMPrime? Maybe there is another method of implementing such feature in detector? In such case I can help to some extent

MoojMidge commented 1 year ago

As I don't have a RPi I am not fully across the issue, but from what I understand it is not a bug, it simply has not been implemented as it is believed this class of devices are not powerful enough and/or do not have sufficient memory bandwidth to decode, render, and also copyback/map, the rendered frame buffer content to memory.

Pretty sure it used to work, but with the move to drop support for vendor specific code in Kodi, and instead use standard Linux video decode and render pipelines, some of the non-core functionality was dropped and not re-implemented.

It is definitely still possible to do, and I think there is a working standalone RPi DRM grabber that can be used with Hyperion, and which could also theoretically be used by the detector in this plugin, but it's not something I am willing to put time into given that I don't have a RPi to use, let alone test/debug.

There was another request to support Kodi chapter markers to identify when the end credits starts, and something similar could be also be done using subtitles, which are both things I may have a look at for devices that can't use the detector.

Basti83x commented 1 week ago

Hello. I have discovered your further development of upnext and am very happy with it. I just have a problem with the detector for the credits. How can I set it up so that it works? Is this function only for video files or also for streams? Does it work with Android? Does it work with Kodi 20? Can you perhaps provide a short guide on what you have to set up to be able to use this function? Excuse my bad English, I use Google Translate.

Mfg

MoojMidge commented 1 week ago

There is nothing to change in the addon settings that will make it work.

You could try changing the Kodi video processing settings to choose a compatible renderer and decoder. The available settings and options will vary depending on the version of Kodi you are using and the device it is running on. Kodi > Settings > Player > Videos > Processing

In general if it is capable of working then it will work without needing to change any settings, and will work for local video files and non-DRM protected streams.

It will work on Kodi 20 if your device supports it.

If it doesn't work then it means that your device does not support the functionality required, and changing the renderer and decoder use non-hardware accelerated methods is likely to result in poor playback on Android devices.

If your device does not support the functionality required, then best to disable the following setting to disable the detector UpNext > Settings > Behaviour > When credits time is unknown > Auto-detect end credits

Basti83x commented 1 week ago

Thanks for the quick reply. I only have Automatic Detection available under render method and it doesn't seem to work with that. Too bad. I was looking forward to it.

Basti83x commented 1 week ago

Would it help to look at my Kodi log to see why it's not working for me?

MoojMidge commented 1 week ago

Not if you are using an Android device. I don't know that the required Kodi functionality was ever implemented on that platform, but certainly does not exist currently.