linux-sunxi / libvdpau-sunxi

Experimental VDPAU for Allwinner sunxi SoCs (obsolete, see https://linux-sunxi.org/Sunxi-Cedrus)
https://linux-sunxi.org/Cedrus
166 stars 80 forks source link

Vdpau screen capture on H3 #61

Open radojko opened 6 years ago

radojko commented 6 years ago

How to capture vdpau output on H3?

I'm trying to capture mpv and mplayer with vdpau but I got black window on the player place when using any capturing app like: screenshot, shutter, fb2png, fbgrab

rellla commented 6 years ago

Hi, capture funtionality is not implemented in libvdpau-sunxi, because that will most likely need https://github.com/linux-sunxi/libvdpau-sunxi/blob/master/surface_output.c#L92 rellla

mittorn commented 6 years ago

cedarx seems to output video directly to sunxi-disp layers using color keys to draw elements on video. I do not know if it's possible to grab data back from this layer

radojko commented 6 years ago

Thanks for answers! The same situation is to grab omxplayer video on RPi, but there is an app to capture all screen including video. I know this is not trivial ( I don't understand rella's answer :smile: ) because video is output to HDMI from GPU not on X11. BTW. I'm very satisfied with video performance and stability on H3, especially HEVC decoding, and this screen capture is only missing piece to use H3 on my project :(

rellla commented 6 years ago

The problem is, that video and osd/gui are not rendered into 1 common layer, so you can't just dump the output surface into a file. This is sunxi specific, because the display engine uses 2 separate layers to bring everything to screen. Therefore you have to grab the video surface and the osd surface separately, mix them together and dump it into a file. That should easily be possible to code, but it has to be done at all. This https://github.com/rellla/libvdpau-sunxi/commit/d3f1bdb3dc80fc7d932cce20b2fccd6c4cfcfc3e was an ugly trial to do this, but iirc it never worked (correct)... If you want and have the skills, you can look into it to get the principle... rellla

radojko commented 6 years ago

Just looked, but in this moment I would rather pay :beer: to somebody who can help to community :) I no need osd, only video layer composed with x11 desktop. @rellla

What GRAB define in: define GRAB Uncomment this to try experimental get_bits_native support does in the case of enabling we will get and this two layers in framebuffer and then just capture screen with for example fbgrab?

For somebody who is interested in this, this is how is that done on RPi: https://github.com/KanoComputing/kano-screenshot