MoojMidge / service.upnext

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

RPI4 - detector not making captures #24

Open pgranat opened 8 months ago

pgranat commented 8 months 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 8 months 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 8 months 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 8 months 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.