Page 1 of 1

Saving frame data to a video file

PostPosted: Fri May 04, 2018 8:09 am
by zwang135
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!

Re: Saving frame data to a video file

PostPosted: Mon May 07, 2018 7:45 am
by zwang135
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!

Re: Saving frame data to a video file

PostPosted: Mon May 07, 2018 5:52 pm
by Tiago Magalhães
The buffer you get form GetBytes contains the raw pixel data for that single frame.

Re: Saving frame data to a video file

PostPosted: Thu May 17, 2018 12:11 am
by Cameron Nichols
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

Re: Saving frame data to a video file

PostPosted: Thu May 17, 2018 2:04 am
by zwang135
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!

Re: Saving frame data to a video file

PostPosted: Wed Jul 11, 2018 6:19 pm
by smim123
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.