简体   繁体   English

DirectShow网络摄像头录制

[英]DirectShow webcam recording

I need to use DirectShow (C++) for recording a webcam and saving the data to a file. 我需要使用DirectShow(C ++)记录网络摄像头并将数据保存到文件中。

I really don't know how DirectShow works, this is a "stage" (working experience), but at school we didn't study it. 我真的不知道DirectShow是如何工作的,这是一个“阶段”(工作经验),但是在学校里我们没有研究它。

I think the best way to implement this could be: 我认为实现此目标的最佳方法可能是:

  1. List the video devices connected to the computer 列出连接到计算机的视频设备
  2. Select the correct camera (there will be only one) 选择正确的相机(只有一个)
  3. Retrieve the video 检索视频
  4. Save it to a file 保存到文件

Now there are two problems: 现在有两个问题:

  1. Where can I find a good reference book or how do I start? 在哪里可以找到好的参考书或如何开始?
  2. The saved video shouldn't be too big, does DirectShow provide a way to compress it? 保存的视频不应太大,DirectShow是否提供压缩方法?

I won't use OpenCV because sometime it doesn't work properly (It doesn't find the camera). 我不会使用OpenCV,因为有时它无法正常工作(找不到相机)。 Are there any high level wrapper that could help? 是否有任何高级包装可以帮助您?

EDIT: the program won't have a window, it will run in background called by a dll. 编辑:程序将没有窗口,它将在dll调用的后台运行。

Where can I find a good reference book or how do I start? 在哪里可以找到好的参考书或如何开始?

DirectShow introduction material DirectShow入门资料

The saved video shouldn't be too big, does DirectShow provide a way to compress it? 保存的视频不应太大,DirectShow是否提供压缩方法?

Yes it provides capabilities to attach codecs, that needs to be installed in the system. 是的,它提供了附加编解码器的功能,该功能需要在系统中安装。 These are typically third party codecs (for reasons beyond the scope of brief answer). 这些通常是第三方编解码器(出于超出简要回答范围之外的原因)。 You might want to record into Windows Media files to not depend on third party codecs. 您可能想要记录到Windows Media文件中,而不依赖于第三方编解码器。 SWee more on MSDN: Choosing a Compression Filter . 在MSDN上进一步了解: 选择压缩过滤器

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM