请问如何取得采集摄像机视频后的原始数据?
我从CameraCapture的例子编译后运行程序,程序从摄像机取得视频后,直接编码和生成ASF文件,代码如下,但我不想这么取得ASF文件,我想直接获取摄像机取得的视频流裸数据(即RGB数据或YUV数据),然后自己编码成H.264码流,该怎么改造程序呢,大家给给思路吧。
//
// Create the capture graph builder and register the filtergraph manager.
//
CHK( m_pCaptureGraphBuilder.CoCreateInstance( CLSID_CaptureGraphBuilder ));
CHK( pFilterGraph.CoCreateInstance( CLSID_FilterGraph ));
CHK( m_pCaptureGraphBuilder->SetFiltergraph( pFilterGraph ));
//
// Create and initialize the video capture filter
//
CHK( m_pVideoCaptureFilter.CoCreateInstance( CLSID_VideoCapture ));
CHK( m_pVideoCaptureFilter.QueryInterface( &pPropertyBag ));
// We are loading the driver CAM1 in the video capture filter.
CHK( GetFirstCameraDriver( wzDeviceName ));
varCamName = wzDeviceName;
if( varCamName.vt != VT_BSTR )
{
ERR( E_OUTOFMEMORY );
}
CHK( PropBag.Write( L"VCapName", &varCamName ));
CHK( pPropertyBag->Load( &PropBag, NULL ));
// Everything succeeded, the video capture filter is added to the filtergraph
CHK( pFilterGraph->AddFilter( m_pVideoCaptureFilter, L"Video Capture Filter Source" ));
//
// Third step: Create the video encoder DMO, load the WMV9 encoder, and
// add it to the graph
//
// Create the video encoder
CHK( pVideoEncoder.CoCreateInstance( CLSID_DMOWrapperFilter ));
CHK( pVideoEncoder.QueryInterface( &pWrapperFilter ));
// Load the WMV9 DMO
CHK( pWrapperFilter->Init( CLSID_CWMV9EncMediaObject, DMOCATEGORY_VIDEO_ENCODER ));
// Everything succeeded, let's add the encoder to the graph
CHK( pFilterGraph->AddFilter( pVideoEncoder, L"WMV9 DMO Encoder" ));
//
// Create the ASF multiplexer and add it to the graph
//
CHK( m_pCaptureGraphBuilder->SetOutputFileName( &MEDIASUBTYPE_Asf, L"\\video1.asf", &pASFMultiplexer, &pFileSinkFilter ));
//
// Connect the video capture filter, the encoder and the multiplexer together
//
CHK( m_pCaptureGraphBuilder->RenderStream( &PIN_CATEGORY_CAPTURE, &MEDIATYPE_Video, m_pVideoCaptureFilter, pVideoEncoder, pASFMultiplexer ));
//
// Create the capture graph builder and register the filtergraph manager.
//
CHK( m_pCaptureGraphBuilder.CoCreateInstance( CLSID_CaptureGraphBuilder ));
CHK( pFilterGraph.CoCreateInstance( CLSID_FilterGraph ));
CHK( m_pCaptureGraphBuilder->SetFiltergraph( pFilterGraph ));
//
// Create and initialize the video capture filter
//
CHK( m_pVideoCaptureFilter.CoCreateInstance( CLSID_VideoCapture ));
CHK( m_pVideoCaptureFilter.QueryInterface( &pPropertyBag ));
// We are loading the driver CAM1 in the video capture filter.
CHK( GetFirstCameraDriver( wzDeviceName ));
varCamName = wzDeviceName;
if( varCamName.vt != VT_BSTR )
{
ERR( E_OUTOFMEMORY );
}
CHK( PropBag.Write( L"VCapName", &varCamName ));
CHK( pPropertyBag->Load( &PropBag, NULL ));
// Everything succeeded, the video capture filter is added to the filtergraph
CHK( pFilterGraph->AddFilter( m_pVideoCaptureFilter, L"Video Capture Filter Source" ));
//
// Third step: Create the video encoder DMO, load the WMV9 encoder, and
// add it to the graph
//
// Create the video encoder
CHK( pVideoEncoder.CoCreateInstance( CLSID_DMOWrapperFilter ));
CHK( pVideoEncoder.QueryInterface( &pWrapperFilter ));
// Load the WMV9 DMO
CHK( pWrapperFilter->Init( CLSID_CWMV9EncMediaObject, DMOCATEGORY_VIDEO_ENCODER ));
// Everything succeeded, let's add the encoder to the graph
CHK( pFilterGraph->AddFilter( pVideoEncoder, L"WMV9 DMO Encoder" ));
//
// Create the ASF multiplexer and add it to the graph
//
CHK( m_pCaptureGraphBuilder->SetOutputFileName( &MEDIASUBTYPE_Asf, L"\\video1.asf", &pASFMultiplexer, &pFileSinkFilter ));
//
// Connect the video capture filter, the encoder and the multiplexer together
//
CHK( m_pCaptureGraphBuilder->RenderStream( &PIN_CATEGORY_CAPTURE, &MEDIATYPE_Video, m_pVideoCaptureFilter, pVideoEncoder, pASFMultiplexer ));
...全文
相关推荐
海康网络摄像机视频采集
海康网络摄像机视频采集, C# 控制四组网络摄像机,扫码条码开始视频采集,再次扫码条码结束视频采集,保持视频到固定额位置.
C/C++音视频开发技术要点与学习路线
总体来讲,音视频开发是有一定的技术门槛的,我觉得至少需要在这个领域踏踏实实积累个3-5年,才能对音视频相关的开发知识有一个整体、深刻的理解。从技术上来讲,需要从如下两个大类知识点上去积累:音视频开发的主要编程语言就是C和C++。这块的专业知识积累是通用的,并不局限于某个特定的行业,属于程序员的技术功底。可以重点关注如下几个方面:这块属于从事音视频行业的专业知识。这块的专业知识是非常多的,每个功能模块背后涉及很多专业的知识。音视频的开发可以分为两大块,涉及的内容大致如下:上述内容中,客户端应用开发、音视频引擎
ffmpeg 采集摄像机流(rtsp)后推流(rtmp)
VS2013,代码齐全,rtsp采集网络摄像机以后向流媒体服务器推流,vlc拉流。
matlab开发-实时麦克风和摄像机数据采集和音频视频处理
matlab开发-实时麦克风和摄像机数据采集和音频视频处理。这个matlab代码是一个实时音频和图像处理的演示。
基于天敏VC3000视频采集卡的摄像机标定程序
基于天敏VC3000视频采集卡的摄像机标定程序


多媒体/流媒体开发
