- Posts: 8
- Joined: Thu Feb 21, 2019 7:23 am
- Real Name: Antonio Castles
The reason for the BGRA conversion in the CaptureStills sample is to ensure that the video frame is in a known format that we can save out to PNG file (BGRA is more widely accepted format for PNG codecs). This then allows the sample to work when either YUV 422 or RGB 444 is captured on the wire.
The following block of code in CaptureStills.cpp performs the conversion:
- Code: Select all
if (receivedVideoFrame->GetPixelFormat() == bmdFormat8BitBGRA)
{
// Frame is already 8-bit BGRA - no conversion required
bgra32Frame = receivedVideoFrame;
bgra32Frame->AddRef();
}
else
{
bgra32Frame = new Bgra32VideoFrame(receivedVideoFrame->GetWidth(), receivedVideoFrame->GetHeight(), receivedVideoFrame->GetFlags());
result = deckLinkFrameConverter->ConvertFrame(receivedVideoFrame, bgra32Frame);
if (FAILED(result))
{
fprintf(stderr, "Frame conversion to BGRA was unsuccessful\n");
captureRunning = false;
}
}
You can modify this to bypass the conversion, or if you still want to be able to support RGB 444 formats on the wire, then you can generate a class similar to Bgra32VideoFrame, but for converting to bmdFormat10BitYUV pixel format instead (refer to section 2.7.4 of DeckLink SDK Manual).
Regards
Cameron