Reputation: 1
Exactly what the title says - I am receiving raw YUV byte arrays (in planar YUV4:2:0 format) which I want to set as a source in MediaPlayerElement for my WinUI3 application. Since this is a real-time video feed, I want to avoid delay in rendering as much as possible. What is the best (and fastest) way to do this?
Thanks for your help
Upvotes: 0
Views: 189
Reputation: 67447
You can't, MediaPlayerElement
handles rendering real video files (avi, mp4, mkv, etc). What you have is raw frame data.
You have many options, the one I personally went with (albeit not for winui3) is using OpenGL to stream the three data channels as textures and decode them in a fragment shader to RGB colors.
For WinUI3 specifically, you have a couple of options if you care about efficiency (as you should for video rendering):
SwapChainPanel
class that gives you a DX11 object you can render with. You can then implement exactly what I described above.WriteableBitmap
approach, but you'll have to decode the streams to RGB on the CPU yourself first. Less efficient, but easier to implement.Upvotes: 0