Converting frames to JPEG

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

dershver

  • Posts: 6
  • Joined: Tue Apr 30, 2019 5:17 pm
  • Real Name: Paul Klahr

Converting frames to JPEG

PostTue Apr 30, 2019 5:31 pm

I am using the Blackmagic SDK on Windows 10. I am trying to modify the
the CapturePreview sample program to send JPEGs for the frames received to another process.
Im am trying to use the ConvertFrame() method by creating a new frame with the 'bmdFormat12BitRAWJPEG' format. I have not yet tested this code. My problem is that I need to know the
size of the data in the new compressed frame. Obviously, I cannot use GetRowBytes() because this
is not applicable to JPEG compressed data.

Any help would be appreciated.
Offline

Cameron Nichols

Blackmagic Design

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

Re: Converting frames to JPEG

PostWed May 01, 2019 3:01 am

Hi Paul,

The pixel format bmdFormat12BitRAWJPEG is for Cintel only, the DeckLink API itself does not support image compression.

Please have a look at the StillsCSharp (C#) and the CaptureStills (C++, PNG only) samples in the Desktop Video SDK package for working examples of how to capture a video frame to image file.

Regards
Cameron
Offline

dershver

  • Posts: 6
  • Joined: Tue Apr 30, 2019 5:17 pm
  • Real Name: Paul Klahr

Re: Converting frames to JPEG

PostThu May 02, 2019 8:54 pm

Thank you for your prompt reply. I tried using the code from the CaptureStills project.
It is failing in the module ImageWriterWin.cpp. It is in the following code snippet:

// Bitmap pixel format WICPixelFormat32bppRGB will match Bgra32VideoFrame
result = bitmapFrame->SetPixelFormat(&pixelFormat);
if (FAILED(result) || (!IsEqualGUID(pixelFormat, GUID_WICPixelFormat32bppBGRA)))
// Unable to support 32-bit RGB
goto bail;

Is there something I can download so my system will support 32-bit RGB ? Or can I change
the frame capture code to use a different pixel format ?

Also, I would like to have the JPEG in memory not written to a file. Is there an easy method to
have it saved in memory ?

Return to Software Developers

Who is online

Users browsing this forum: No registered users and 13 guests