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.

Re: Saving frame data to a video file

PostPosted: Mon Nov 05, 2018 4:07 pm
by amolina
Hi guys,

We're also trying to record a file (mp4, avi or whatever) using the DecklinkInputDevice from StillCSharp sample. We succeded saving a png image file following the example, but we're not sure if we can do it with continuous images as a video file. Did anyone succeed? By the way, we are doing this with a Decklink Quad 2.

Thanks very much for your help!

Re: Saving frame data to a video file

PostPosted: Thu Nov 08, 2018 1:24 am
by zwang135
amolina wrote:Hi guys,

We're also trying to record a file (mp4, avi or whatever) using the DecklinkInputDevice from StillCSharp sample. We succeded saving a png image file following the example, but we're not sure if we can do it with continuous images as a video file. Did anyone succeed? By the way, we are doing this with a Decklink Quad 2.

Thanks very much for your help!

Hi Antonio,

I think you will need some external lib that does video encoding, FFmpeg would be a choice.

Zicheng

Re: Saving frame data to a video file

PostPosted: Thu Nov 08, 2018 8:50 am
by amolina
We already launch ffmpeg as an external application to capture from the decklink input interface, but we would like to improve our code and integrate this "external use" as part of our application. Our first intention is to use the SDK, but we are not sure if this is something we can do with a decklink quad 2. We've checked that streaming encoder functionality is supported by certain devices. In case this option is not possible, it would be very useful to know some libraries .NET/C# that we can integrate in our project and that be able to do this streaming encoding.

Thanks

Re: Saving frame data to a video file

PostPosted: Fri Nov 09, 2018 1:12 am
by zwang135
amolina wrote:We already launch ffmpeg as an external application to capture from the decklink input interface, but we would like to improve our code and integrate this "external use" as part of our application. Our first intention is to use the SDK, but we are not sure if this is something we can do with a decklink quad 2. We've checked that streaming encoder functionality is supported by certain devices. In case this option is not possible, it would be very useful to know some libraries .NET/C# that we can integrate in our project and that be able to do this streaming encoding.

Thanks

https://github.com/Ruslan-B/FFmpeg.AutoGen
This project helps you to use FFmpeg in a C# app easily.