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: 13
  • 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: 13
  • 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: 442
  • 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: 13
  • 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: 6
  • 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.
Offline

amolina

  • Posts: 3
  • Joined: Mon Nov 05, 2018 3:57 pm
  • Real Name: Antonio Molina

Re: Saving frame data to a video file

PostMon Nov 05, 2018 4:07 pm

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!
Offline

zwang135

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

Re: Saving frame data to a video file

PostThu Nov 08, 2018 1:24 am

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
Offline

amolina

  • Posts: 3
  • Joined: Mon Nov 05, 2018 3:57 pm
  • Real Name: Antonio Molina

Re: Saving frame data to a video file

PostThu Nov 08, 2018 8:50 am

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
Offline

zwang135

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

Re: Saving frame data to a video file

PostFri Nov 09, 2018 1:12 am

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.

Return to Software Developers

Who is online

Users browsing this forum: No registered users and 18 guests