NodeJS ffi-napi H.264 buffer to mp4 file

28 Views Asked by At

I have a DVR, and I'm tring to use its SDK to save real-time monitoring to an MP4 file. But I didn't get it.

const fRealDataCallBackEx = ffi.Callback('void', ['int64', 'uchar', 'pointer', 'uchar', 'uchar', 'uchar'],
    function (lRealHandle, dwDataType, pBuffer, dwBufSize, param, dwUser) {
        console.log('pBuffer: ', pBuffer);
        console.log('---'.repeat(20));
        console.log('dwBufSize: ', dwBufSize);
    });

I stopped because it was too much to put here. The result of the console.log was:

pBuffer:  <Buffer@0x7fce6819c040 type: { size: 0, indirection: 1, get: [Function: get], set: [Function: set], name: 'void', ffi_type: <Buffer@0x7fce6821ea00 name: 'void'> }>
dwBufSize:  204
------------------------------------------------------------
pBuffer:  <Buffer@0x7fce6819c040 type: { size: 0, indirection: 1, get: [Function: get], set: [Function: set], name: 'void', ffi_type: <Buffer@0x7fce6821ea00 name: 'void'> }>
dwBufSize:  116

I really want to know how to read this buffer from this callback function.

0

There are 0 best solutions below