Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RPI4 - detector not making captures #24

Open
pgranat opened this issue Oct 17, 2023 · 3 comments
Open

RPI4 - detector not making captures #24

pgranat opened this issue Oct 17, 2023 · 3 comments

Comments

@pgranat
Copy link

pgranat commented Oct 17, 2023

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

image_data = capturer.getImage()
# Capture failed or was skipped, retry with less data
if not image_data or image_data[-1] != 255:
self.log('Capture failed using {0}kB data limit'.format(
SETTINGS.detector_data_limit
), utils.LOGWARNING)
SETTINGS.detector_data_limit = (
SETTINGS.detector_data_limit - 8
) or 8

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

image_data = capturer.getImage()

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
Copy link
Owner

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
Copy link
Author

pgranat commented Oct 24, 2023

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
Copy link
Owner

MoojMidge commented Oct 24, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants