Capturing stills in 10 bits.

Ask software engineering and SDK questions for developers working on Mac OS X, Windows or Linux.
  • Author
  • Message
Offline

acastles91

  • Posts: 4
  • Joined: Thu Feb 21, 2019 7:23 am
  • Real Name: Antonio Castles

Capturing stills in 10 bits.

PostMon Aug 26, 2019 10:11 am

I have been trying to implement the example of the SDK to capture stills in a project for a while now, and I am stuck with color depth and modes at the moment. There is a part of the code in which frames are converted to 8 bit BGRA images before being written to the disk. I am capturing with a Decklink Mini Recorder 4K, which supports up to 10 bit YUV. How can I by-pass this conversion to have the best possible quality for my frames, which I could later encode into a video? Why is this conversion taking place to begin with?
Thank you!
Offline

Cameron Nichols

Blackmagic Design

  • Posts: 216
  • Joined: Mon Sep 04, 2017 4:05 am

Re: Capturing stills in 10 bits.

PostTue Aug 27, 2019 9:00 pm

Hi Antonio,

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

Return to Software Developers

Who is online

Users browsing this forum: No registered users and 2 guests