DECKLINK DUO2 get bitmap data

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

Le Thi Hang

  • Posts: 4
  • Joined: Thu Jun 08, 2023 7:50 am
  • Real Name: Le Thi Hang

DECKLINK DUO2 get bitmap data

PostTue Sep 05, 2023 8:41 am

Hello, I'm working with decklink duo 2 on C# net core 6. I'm trying to get bitmap data for image processing , but it doesn't work. Please help me!

public void InputVideoFrameArrived(object sender, DeckLinkDeviceInputVideoFrameEventArgs e)
{
if (e.videoFrame.GetFlags().HasFlag(_BMDFrameFlags.bmdFrameHasNoInputSource))
return;

FPSCount++;
double T = DateTime.Now.Subtract(TimeStart).TotalMilliseconds;
if (T > 1000)
{
Debug.WriteLine("FPS: " + (int)(FPSCount * 1000.0f / T));
TimeStart = DateTime.Now;
FPSCount = 0;
}


byte[] mediaFrameBuffer = { };
IntPtr srcPtr;
e.videoFrame.GetBytes(out srcPtr);
System.Runtime.InteropServices.Marshal.Copy(srcPtr, mediaFrameBuffer, 0, e.videoFrame.GetHeight() * e.videoFrame.GetWidth());
System.Runtime.InteropServices.Marshal.ReleaseComObject(e.videoFrame);

Bitmap bmp;
using (var ms = new MemoryStream(mediaFrameBuffer))
{
bmp = new Bitmap(ms);
}
}
Offline

Le Thi Hang

  • Posts: 4
  • Joined: Thu Jun 08, 2023 7:50 am
  • Real Name: Le Thi Hang

Re: DECKLINK DUO2 get bitmap data

PostThu Sep 07, 2023 2:42 am

Help me, please!
Offline

oniongarlic

  • Posts: 59
  • Joined: Thu Dec 05, 2019 9:00 am
  • Location: Turku/Finland
  • Real Name: Kaj-Michael Lang

Re: DECKLINK DUO2 get bitmap data

PostFri Sep 08, 2023 9:08 am

Perhaps try to describe a bit more, what are you doing, and what exactly does not work ? Your app crashes, you get only black, etc.
Check out my free and open software:
CutePocketRemote - https://www.tal.org/projects/cutepocketremote
CuteAtum - https://www.tal.org/projects/cuteatum
Offline

Cameron Nichols

Blackmagic Design

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

Re: DECKLINK DUO2 get bitmap data

PostMon Sep 11, 2023 3:42 am

Hi Le Thi Hang,

Did you try running with the StillCSharp SDK sample? This sample performs the necessary steps to get the Bitmap from the output IntPtr from IDeckLinkVideoFrame::GetBytes on the captured frame object.

I have also tested capturing the Bitmap after update to .NET Core 6 with Upgrade Assistant. Ref https://learn.microsoft.com/en-us/dotne ... t-overview.

Regards
Cameron
Offline

Le Thi Hang

  • Posts: 4
  • Joined: Thu Jun 08, 2023 7:50 am
  • Real Name: Le Thi Hang

Re: DECKLINK DUO2 get bitmap data

PostMon Sep 11, 2023 7:26 am

Hi Cameron, I did try running with the StillCSharp SDK sample. When running on .net framwork it is normal, but when running on .net core 6, I get an error. Error in ConvertFrame function.

Return to Software Developers

Who is online

Users browsing this forum: No registered users and 27 guests