简体   繁体   English

DirectShow .Net摄像机捕获编码输出?

[英]DirectShow .Net camera capture encode output?

recently i have started workin on project of my own which is capturing a camera output using DirectShow .Net. 最近,我开始从事我自己的项目,该项目使用DirectShow .Net捕获摄像机输出。 There are few problems that i don't know how ot solve 1) How can i encode the captured stream into H.264 format.I understand i should some how add filter in the filter graph. 有一些我不知道如何解决的问题1)我如何将捕获的流编码为H.264格式。我知道我应该在过滤图中添加过滤器。 But i wasn't able to find where and how . 但是我无法找到地点和方式。 Also i was not able to find if there is standart H.264 filter or should i download it form some where? 另外我也找不到标准的H.264过滤器,还是应该从哪里下载呢? If i need to download it can it just be a dll to wich i add reference or should it be installer? 如果我需要下载它,它可以只是一个dll,我可以添加参考还是应该作为安装程序? 2) Is there a way to save the captured output into a memory object, some kind of stream or it can only be written to file? 2)有没有一种方法可以将捕获的输出保存到内存对象,某种流或只能写入文件中? Best Regards, Iordan 最好的问候,Iordan

You're can use commercial software from VisioForge or Viscomsoft . 您可以使用VisioForgeViscomsoft的商业软件。

AForge potencial problem - no audio during capture, only video. AForge潜在的问题-捕获期间没有音频,只有视频。 Also output formats is a very limited. 输出格式也非常有限。 But - it's free and open source, if you're have any DirectShow experiense you can add audio support. 但是-它是免费的开源软件,如果您有DirectShow经验,可以添加音频支持。

  1. You will need to use something like FFMpeg or Handbrake. 您将需要使用FFMpeg或Handbrake之类的东西。 Check out http://vidcoder.codeplex.com/ . 查看http://vidcoder.codeplex.com/ AForge also has some video editing abilities and you can also pass filters to it. AForge还具有一些视频编辑功能,您也可以将过滤器传递给它。 There are also several FFMpeg C# wrappers you could use such as https://github.com/crazyender/FFMPEG.net 您还可以使用几种FFMpeg C#包装器,例如https://github.com/crazyender/FFMPEG.net

  2. You should use AForge.net. 您应该使用AForge.net。 All of the hard work is done for you already. 所有的辛苦工作已经为您完成。 Use VideoFileWriter http://www.aforgenet.com/framework/docs/html/4ee1742c-44d3-b250-d6aa-90cd2d606611.htm . 使用VideoFileWriter http://www.aforgenet.com/framework/docs/html/4ee1742c-44d3-b250-d6aa-90cd2d606611.htm I appears that the AForge framework uses FFMpeg under the hood as well (See AForge.Video.FFMPEG namespace). 我看来,AForge框架也在后台使用FFMpeg(请参阅AForge.Video.FFMPEG命名空间)。 You just create a writer and pass it the bitmap/frame writer.WriteVideoFrame(bitmap); 您只需创建一个编写器,然后将其传递给位图/帧writer.WriteVideoFrame(bitmap);

You should fully investigate the video abstractions in AForge. 您应该充分研究AForge中的视频抽象。 You could save yourself considerable amounts of time. 您可以节省大量时间。

Example: http://www.aforgenet.com/framework/samples/video.html 示例: http//www.aforgenet.com/framework/samples/video.html

1) Yes, You should download encoder filter library. 1)是,您应该下载编码器过滤器库。 Most of decoders are supplied with free. 大多数解码器都是免费提供的。 But encoder is not. 但是编码器不是。 If you don't want to pay, you have to find open source Encoder. 如果您不想付款,则必须找到开源的Encoder。 And To use at the graphedit program, you should do dll register with that dll file. 并且要在graphedit程序中使用,您应该使用该dll文件进行dll注册。 Or the installer program do this instead. 或由安装程序执行此操作。 And you also need to check container type like mp4, mkv... In other words you need mux filter to save that in a file. 而且您还需要检查mp4,mkv等容器类型。换句话说,您需要使用mux过滤器将其保存在文件中。 I think someone will link available urls. 我认为有人会链接可用的网址。 Sorry I don't have urls now. 抱歉,我现在没有网址。

2)What is that the means of capture? 2)那是什么捕获手段? Is that Movie? 那是电影吗? or Image? 或图片?

  • In case of Image, There are many sample projects and SampleGrabbers. 对于Image,有许多示例项目和SampleGrabbers。 You can save it to both of a file and memory. 您可以将其保存到文件和内存中。

  • In case of Movie, I'm sure your pc memory is not enougth to them with out encoding. 如果是电影,我确定您的PC内存对编码没有影响。 Make memory stream and pass it to capture manager. 使内存流并将其传递给捕获管理器。

You can also make a filter in order to customize filter to your needs. 您也可以制作过滤器,以根据需要自定义过滤器。 All of information are included in Windows SDK samples. Windows SDK示例中包含所有信息。

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

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