使用 IMediaSample DirectShow.Net 寻找关键帧
据我所知,为了检查某个帧是否是关键帧,我必须检查 IMediaSample::IsSyncPoint() 方法,如果该帧是关键帧,则返回 0 (S_OK),否则返回 false其他情况。
但 IsSyncPoint() 方法只是在抓取并传递给 ISampleGrabberCB::SampleCB() 回调方法的每个帧中返回 0。
我的回调包含的代码很简单:
public int SampleCB ( double sampleTime, IMediaSample mediaSample )
{
Console.WriteLine ( "SampleCB Callback" );
Console.WriteLine ( mediaSample.IsSyncPoint ( ) + " " );
Marshal.ReleaseComObject ( mediaSample );
return 0;
}
我在这里缺少什么?
As far as I know, inorder to check if a frame is a key frame or not, I have to check the IMediaSample::IsSyncPoint() method, which returns 0 (S_OK) if the frame is a key frame, or false in the other case.
But the IsSyncPoint() method is simply returning 0 in every frame that is grabbed and passed to the ISampleGrabberCB::SampleCB() callback method.
The code that my callback include is simple :
public int SampleCB ( double sampleTime, IMediaSample mediaSample )
{
Console.WriteLine ( "SampleCB Callback" );
Console.WriteLine ( mediaSample.IsSyncPoint ( ) + " " );
Marshal.ReleaseComObject ( mediaSample );
return 0;
}
What am I missing here?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您的媒体类型是什么?如果样本采集器正在接收未压缩的视频帧,则每个帧都是一个同步点。
What is your media type? If the sample grabber is receiving uncompressed video frames, then every frame is a sync point.