Hi all,
I’m newbie here. Now what I need is playing live streaming video from a USB camera in UMG. Now I have already read the image from the camera using ffmpeg. The image is just raw image data. How can I render it in UMG?
Thanks,
Hi all,
I’m newbie here. Now what I need is playing live streaming video from a USB camera in UMG. Now I have already read the image from the camera using ffmpeg. The image is just raw image data. How can I render it in UMG?
Thanks,
Basicly, you have to create a texture and copy the pixel data into it.
Then you can use that texture as a brush on an UMG image.
Something like this in C++ :
int32 Width = 1280; //your image size
int32 Height = 720;
const TArray<uint8>* UncomprBGRA = <YOUR UNCOMPRESSED PIXEL DATA>;
//Create a texture 2d
UTexture2D* tex = UTexture2D::CreateTransient(Width, Height, PF_B8G8R8A8);
if(tex)
{
//Lock it
void* TextureData = tex->PlatformData->Mips[0].BulkData.Lock(LOCK_READ_WRITE);
//Copy pixel data
FMemory::Memcpy(TextureData, UncomprBGRA->GetData(), UncomprBGRA->Num());
//Unlock
tex->PlatformData->Mips[0].BulkData.Unlock();
//Update texture
tex->UpdateResource();
}
Thank you very much, datee, let me try it.