visioforge / .Net-SDK-s-samples

VisioForge .Net SDKs samples - Video Capture SDK, Video Edit SDK, Media Player SDK, Media Blocks SDK, Video Fingerprinting SDK
https://www.visioforge.com
MIT License
50 stars 24 forks source link

VideoFrameBufferEventArgs.FrameArray is always null when the event is triggered #5

Closed fortminors closed 3 years ago

fortminors commented 3 years ago

Hello!

First of all, that's a great library to use and thank you for sharing it with everyone.

I've downloaded the Simple Video Capture Demo WPF example and just added these lines of code to btStart_Click:

VideoCapture1.OnVideoFrameBuffer += VideoCapture1_OnVideoFrameBuffer;
VideoCapture1.OnVideoFrameBufferOriginal += VideoCapture1_OnVideoFrameBufferOriginal;
VideoCapture1.OnVideoFrameBufferRAW += VideoCapture1_OnVideoFrameBufferRAW;

and the corresponding event handlers are:

    private void VideoCapture1_OnVideoFrameBufferRAW(object sender, VideoFrameBufferEventArgs e)
    {
        byte[] ar = e.FrameArray;
    }

    private void VideoCapture1_OnVideoFrameBufferOriginal(object sender, VideoFrameBufferEventArgs e)
    {
        byte[] ar = e.FrameArray;
    }

    private void VideoCapture1_OnVideoFrameBuffer(object sender, VideoFrameBufferEventArgs e)
    {
        byte[] ar = e.FrameArray;
    }

Expected behaviour:

Actual behaviour:

I am kindly asking for help as getting the byte array straight is very useful.

Also, if there is anything that I am doing wrong, please let me know :)

visioforge commented 3 years ago

Hi

e.FrameArray is an optional field that usually empty. Frame located at e.Frame.Data (IntPtr) as an unmanaged memory array.

OnVideoFrameBuffer is an event that always available. Two other events are optional for specific situations.