Forum

SkiaRenderer and SkiaTexture output blank (or flicker) when SKImage comes from VideoPlayer(Skia)

Hi all,

I found out a weird behavior yesterday with 2021.4.8, but it’s also in 2021.4.9 :

  1. It looks like the SkiaRenderer and the SkiaTexture are not capable of outputting anything when the SKImage in input comes from the VideoPlayer(Skia). If the SKImage comes from the ImageReader, then it’s working correctly.
    If I’m using a ToImage + ImageToTexture, then it works, but the ToImage is really taking a lot of performance, so it’s not ideal in my use case.

  2. Also, some flickering can be visible sometimes. As if there is a conflict in the background with the image and the video frame.

I made this simple patch to document:

Video_SKImageToStride_Bug.vl (31.3 KB)

EDIT : Tested on two machines: desktop with Nvidia GTX 1080 only, and laptop with two graphic cards but using Nvidia GTX 1050 with vvvv. Both machines show the same result.

Danke!

Ähm yes, this is indeed a known issue. Skia and Stride use different graphics contexts, that’s why any texture (or SKImage for that matter) generated on one can’t be used on the other. To have them both use the same context we’re waiting on some upstream changes in SkiaSharp which when implemented would allow us to test that scenario again.

I wonder whether we could provide some sort of pin to force the usage of the Stride context in the relevant (texture backed) SKImage producing nodes (like the VideoPlayer). In theory that should work as long as the whole Skia scene is rendered by the Stride sink nodes.

So I took the liberty to add this pin in a preview package (nuget install VL.Video.MediaFoundation -pre -version 1.0.13-preview). It’s an optional white pin on VideoPlayer (Skia). So you’ll have to unlock it through the context menu, set it to true and restart your patch. You’ll notice that you’ll no longer see anything meaningful in its tooltip after doing so because it is the other way round now, the tooltip accessing the image with the wrong context.

1 Like

Thank you very much @Elias!

The workaround for the additional pin in the 1.0.13-preview works nicely in my simplified patch.
It’s good to have this option while you wait for an update from SkiaSharp to test a ‘better’ fix.

As you mentioned, the nodes using Skia after the VideoPlayer (Skia) then show broken tooltips but that is not so important for me.

Should I close this topic or still keep it running as long as an official fix is not released?