abrenoch / hyperion-android-grabber

Screen grabber for hyperion
MIT License
188 stars 31 forks source link

No LED response in videos on Chromecast with Google TV #193

Open bcrowie opened 1 year ago

bcrowie commented 1 year ago

I have two of the Chromecast with Google TV devices, one is the 4k model and another is the new HD model, both are updated to Android 12.

When using the Hyperion Android Grabber the LEDs respond correctly to the home menu and menus within apps, but once you start playing a video in any of the apps, whether it be Plex, YouTube, Jellyfin, Twitch, etc... the LEDs go black and nothing shows.

Not sure if this is related to the Android 12 update as I just upgraded from FireTV Sticks, but the android grabber worked fine on the FireTV Sticks before swapping them out.

Running HyperionNG in a virtual machine, build 2.0.13 - GitHub-dfd9438/5dc696b-1653218333 Hyperion Android Grabber from the Google Play Store

bcrowie commented 1 year ago

After playing with this a bit I went into the Chromecast Display & Sound settings, then Match content frame rate and changed it to 'Never'. When I went into Plex I played a video and it was able to grab a couple of frames instead of making the LEDs just go entirely dim but then it just started flickering one of the frames it was able to capture. I went back to those settings and tried 'Non-seamless' but wasn't able to reproduce the symptoms, even after going back to 'Never'. Seems like this might be an issue with the Frame Rate Matching feature in Android 12.

Nosskirneh commented 1 year ago

Sounds an awful lot similar to the issue I faced (and still face) after upgrading to Android 12. https://github.com/abrenoch/hyperion-android-grabber/issues/192

Not sure what changed in the API. I don’t mind spending time to fix it (already have cloned and debugged the code) but I don’t understand what changed between the Android versions.

bcrowie commented 1 year ago

Sounds an awful lot similar to the issue I faced (and still face) after upgrading to Android 12. #192

Not sure what changed in the API. I don’t mind spending time to fix it (already have cloned and debugged the code) but I don’t understand what changed between the Android versions.

I would help you out but I have no experience with Java, just Javascript and Python. I really think it has something to do with the framerate switching in Android 12. When I first tried a video it showed nothing on the LEDs, but when I turned the frame rate matching to Never I then got flickering of the LEDs the next time I played a video.

The frame rate matching is new to Android 12. It wasnt on Android 10 that we had before.

PeterMalast commented 1 year ago

When you in Kodi turn off "Player setting -> videos -> Hardware acceleration-MediaCoder(Surface) Leds will be works but playback isn't smooth 🤦🏼‍♀️ I combination many settings but without result and if I remember downgrade isn't possible so "GOOD" JOB Google 🤦🏼‍♀️

abrenoch commented 1 year ago

Hey I really wish I was able to offer more help here. Between the inconsistent behavior across devices, and Google's undying need to nerf their own products, and not to mention DRM... There is unfortunately a whole lot that can not work as expected.

As far as I know, there is only one 'official' way to grab the screen content on an android device. So in situations where a specific piece of hardware behaves differently than another, there really is not a whole lot I can do (especially with my very surface level understanding of the android APIs) differently.

Then there are the separate surfaces android draws content on; some of these surfaces are protected by DRM and some not. HDR content seems to influence this a lot, but not always seemingly. But theses surfaces show up as black to the screen grabber API, if you connect an app like scrcpy you can see this behavior in more places than you might expect. This is why sometimes menus seem to work but not media.

One thing that could be tried for performance glitches is setting the horizontal and vertical led counts lower. Those settings only exist to determine the resolution at which the screen grabber gets content (no need to process an image larger than what your lights can display), so setting them lower should make the grabber do less work.

I may have been lucky I developed this for a shieldTV, as it has always worked within my expectations, and I haven't tested it on much else besides the mobile builds.

monolyf commented 1 year ago

I have been having the same issue since updating my Chromecast with Google TV to Android 12. Menus and UI display fine with Hyperion, but as soon as you play video it stops working.

I found that in plex that if videos are encoded as MPEG 2 they work fine, and also Live TV and TV recordings, as they are broadcasted in a mpeg2 TS. But everything else, either the Hyperion LEDs are blank or it plays the 1st couple of frames repeated in a loop. changing the frame rate or the field order around on the MPEG 2 still plays fine. the only way I can make that video not work is if I change the codec. Have tried h264, h265, prores, avi, and WMV and they all don't play right in that format. I have also encoded a movie that didn't originally work that was a h264 mp4, to a MPEG 2 and that now works with Hyperion. So my guess is something breaks the screen recording/capture in android 12 for most video playback except mpeg2 for some reason, either google has done that to stop apps from recording any video whatsoever, maybe to try and prevent apps from recording youtube videos??. and didn't include mpeg2s as almost nothing uses mp2 anymore? or something to do with how video is played back in android 12 now and doesn't play nice with the screen record function, but doesn't really explain why Mpeg 2 is the exception.

But just to confuse things more, in kodi, the mp2 video plays fine as expected, but also all the test re-exports to different codecs i made also works fine in kodi too, but not the mp2 re-encode of the movie that was originally in mp4 that didn't work in Plex.

Running the Beta 1.1 build of the Hyperion Grabber

Jordi24 commented 1 year ago

Hi all,

Any update on this issue? I have been very happy in the past with my Hyperion setup but now I have Android 12 on my Chromecast with Google TV, it became sort of useless... I have tried both the Google Play version as well as the latest beta release but unfortunately both do not work for me. Using the Hyperion Web Interface, I have been able to deduce that Hyperion only receives the first few frames on repeat. This loop is also visualized in the LEDs. The funny thing is that when you pause a video, the loop also gets paused but then continues again when you press play. Similarly to what has been said above, the grabber works fine in all of the menu's. It is only the video playback that is causing issues.

Although I feel it might be an overall DRM issue (this should not be a problem for Plex?), it would be great if this could somehow be solved! Sadly I do not have the programming skills to have a look myself but if you need an .apk tester, I'm in!

thehijacker commented 1 year ago

Discovering more and more topics with same issue. I have the same problem with Mi Stick 4K. It is Android 11. But same problem. Menus are fine, but no video.

manuel-rw commented 1 year ago

Same problem with my Chromecast. I don't have the space to run a HDMI splitter and grabber, so it'd be very useful if this finally worked. I use Jellyfin, and as far as I'm concerned, that doesn't use any DRM / protection? It works fine when I'm in the Jellyfin menus, but the ExoPlayer doesn't work (LEDs flickering brightly)

DeBendeBurcht commented 11 months ago

Im having the same issue, looking at the AndroidManifest.xml file in the source code of the app i noticed that you only call <uses-feature> hardware permissions and that you dont call <uses-permission android:name="android.permission.CAPTURE_VIDEO_OUTPUT" /> now this may be a stupid question as im an electrical engineer and not an app developer, but ive found that the way these screen recording permissions work have changed around android 9 or 10 (Search google for : Restricted Screen Reading on source.android) would we still need to call the <uses-permission for CAPTURE_VIDEO_OUTPUT also?

Jordi24 commented 11 months ago

@DeBendeBurcht, I am no app developer either but would not that permission then also prevent recording the menu's or is it specifically for video only? Would you be able to create a test build to verify your suggestions?

DeBendeBurcht commented 11 months ago

I think we would need to test that to be sure, but im pretty sure that if we get content working, everything (youtibe plex, and interfaces for example) should work, with exception for actually drm protected content. Ive made an edit to the code, but i wasnt able to build the gradle project, yet there were no build errors with my edit

DeBendeBurcht commented 8 months ago

Getting back on this, i wasnt able to build a test build sadly, but i have found a small work around! The issue doesnt affect chromecast mirroring from a laptop, so if you want to watch a movie, cast your screen from your laptop (specifically has to be screen mirroring)

eatoff8 commented 7 months ago

I'm experiencing the same as everyone else here it seems.

I upgraded to a NVIDIA shield tv pro box and the screen capture now works fine. Would have been nice to have it working on the Google dongle since it was so cheap, but that's been my solution now