大华的录像文件无法用VLC视频播放器打开,用大华的播放器可以播放。我用图片中的接口回调h264的数据无法不放,应该是大华给封装了.可是我不知道他们怎么封装的.就想问问大佬们怎么去解析大会回传的这个流
bIsOk = DHOriginalSDK.CLIENT_SetRealDataCallBackEx((IntPtr)m_itfCameraControl.rHandle, m_RealDataCallBack, dUser, 0x02);
这是调用接口.。下面是实现回调函数,一个简单的测试。
private void RealDataCallBack(IntPtr lRealHandle, uint dwDataType, IntPtr pBuffer, uint dwBufSize, int param, IntPtr dwUser)
{
FileStream fs = null;
try
{
if (string.IsNullOrEmpty(this.m_strVedioFilePath) ||
string.IsNullOrWhiteSpace(this.m_strVedioFilePath)) throw new Exception();
byte[] destination = new byte[(int)dwBufSize];
if (dwBufSize != null & dwBufSize > 0)
{
Marshal.Copy(pBuffer, destination, 0, (int)dwBufSize);
byte[] Datadestination = new byte[destination.Length];
Array.Copy(destination, 0, Datadestination, 0, Datadestination.Length);
//SWLogger.LogInfo("流数据为:"+ BitConverter.ToString(destination));
fs = new FileStream(this.m_strVedioFilePath, FileMode.Append, FileAccess.Write);
fs.Write(Datadestination, 0, Datadestination.Length);
//fs.Write(destination, 0, destination.Length);
}
}
catch (Exception ex)
{
SWLogger.LogError("在解码数据是报错了:" + ex.Message);
}
finally
{
//@! 所有流类型都要关闭流,否则会出现内存泄露问题
if (null != fs)
{
fs.Flush();
fs.Close();
fs = null;
}
}
}
有没做视频解析的大佬们啊
这是部分流数据,他的包头大佬们看看是不是可以看得懂。