Saving frame data to a video file

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

zwang135

  • Posts: 6
  • Joined: Fri May 04, 2018 1:30 am
  • Real Name: Zicheng Wang

Saving frame data to a video file

PostFri May 04, 2018 8:09 am

Hello friends!

I'm currently working on extending the CapturePreviewCSharp example from the newest version of SDK, to get rid of some UI bugs of the Media Express. I want it to save the captured videos to local, just like Media Express does; however, after spending couple hours learning SDK, I still couldn't figure out how.

Basically my problem is idk how to deal with the frame data that I get from calling GetBytes() under VideoInputFrameArrived(). How do I convert them to a video file? Can someone help me? Maybe providing me a short example? I appreciated it!
Offline

zwang135

  • Posts: 6
  • Joined: Fri May 04, 2018 1:30 am
  • Real Name: Zicheng Wang

Re: Saving frame data to a video file

PostMon May 07, 2018 7:45 am

Can someone tell me what is contained in the data buffer of a video frame? Is it simply the data representing an image? Or it does contain something else? Thanks!
Offline

Tiago Magalhães

  • Posts: 2
  • Joined: Mon Jul 25, 2016 3:14 pm

Re: Saving frame data to a video file

PostMon May 07, 2018 5:52 pm

The buffer you get form GetBytes contains the raw pixel data for that single frame.
Offline

Cameron Nichols

Blackmagic Design

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

Re: Saving frame data to a video file

PostThu May 17, 2018 12:11 am

Hi Zicheng,

The IDeckLinkVideoFrame::GetBytes method provides raw pixel data as per the captured pixel format (See 2.7.4 Pixel Formats in the DeckLink SDK manual).

In the most recent DeckLink SDK 10.10, there is a sample StillsCSharp as an example for using GetBytes to convert captured frame to bitmap.

I hope this is useful to you.

Regards
Cameron
Offline

zwang135

  • Posts: 6
  • Joined: Fri May 04, 2018 1:30 am
  • Real Name: Zicheng Wang

Re: Saving frame data to a video file

PostThu May 17, 2018 2:04 am

Tiago Magalhães wrote:The buffer you get form GetBytes contains the raw pixel data for that single frame.

Thanks Tiago, I spent couple days and finally figured out how to convert those data to correct images.

Cameron Nichols wrote:Hi Zicheng,

The IDeckLinkVideoFrame::GetBytes method provides raw pixel data as per the captured pixel format (See 2.7.4 Pixel Formats in the DeckLink SDK manual).

In the most recent DeckLink SDK 10.10, there is a sample StillsCSharp as an example for using GetBytes to convert captured frame to bitmap.

I hope this is useful to you.

Regards
Cameron

Hi Cameron, I just checked out this example in the new SDK, which is really helpful to me. I will start working on this example, thank you!
Offline

smim123

  • Posts: 2
  • Joined: Thu Jun 07, 2018 6:34 pm
  • Real Name: Sirajum Mim

Re: Saving frame data to a video file

PostWed Jul 11, 2018 6:19 pm

Cameron Nichols wrote:Hi Zicheng,

The IDeckLinkVideoFrame::GetBytes method provides raw pixel data as per the captured pixel format (See 2.7.4 Pixel Formats in the DeckLink SDK manual).

In the most recent DeckLink SDK 10.10, there is a sample StillsCSharp as an example for using GetBytes to convert captured frame to bitmap.

I hope this is useful to you.

Regards
Cameron

Hi Cameron,

I am trying to capture a video and save it as an avi file. StillCSharp example allows it to be saved in other file types. Any suggestion where could it be modified to save as avi format?

Thanks.

Return to Software Developers

Who is online

Users browsing this forum: No registered users and 2 guests