如何将视频从网络摄像机编码为​​C#中的H.264? [英] How to encode Video from Web-Camera into H.264 in C#?

查看:738
本文介绍了如何将视频从网络摄像机编码为​​C#中的H.264?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在C#中将来自网络摄像头的视频编码为H.264?

How do you encode video from Webcam into H.264 in C#?

我需要什么


  • MSDN如果有任何帮助。

  • 打开源代码库/包装器进行编码/解码。

  • 教程和博客文章如何做。

一些例子如何编码到3GP或FLV或其他文件大小较小的文件将是非常感激。

Some examples of of how to encode into 3GP or FLV or something else with low file size would be more than appreciated.

推荐答案

您需要查看DirectShow SDK。

You will need to look into DirectShow SDK.

到H.264是不可能的,但是有商业的activex控件可以帮助你。但你需要了解一些事情,

Encoding into H.264 is directly not possible, however there are commercial activex controls that can help you. But you need to understand few things,

DirectShow是音频/视频处理框架,你可以使用图形编辑工具将你的设备放在图形上并测试它。你必须编写类似的代码来构建图形,图形是彼此交互以产生最终输出的设备/对象的链。

DirectShow is audio/video processing framework, and you can use graph edit tool to put your devices on the graph and test it. And you have to write similar code to build graph, graph is chain of devices/objects that interact with each other to produce final output.

DirectShow可以在.NET中使用,你可以使用GraphEditPlus工具创建一个图形并在.NET中使用它,但我怀疑.NET是更好的方式,因为它可能导致未知的错误,因为DirectShow是紧密地绑定到COM。如果你创建ActiveX控件,在本地C + +和使用DirectShow做整个录音,并使用ActiveX在WPF,这将是更稳定不易编程。

DirectShow can be used in .NET, you can use GraphEditPlus tool to create a graph and use it in .NET, however I doubt .NET is better way because it may lead to unknown errors as DirectShow is closely bound to COM. If you create ActiveX control, in native C++ and use DirectShow to do entire recording and you use ActiveX in WPF, that will be more stable however difficult to program.

将需要如下的图形,

Video Source => Demux -> Audio Stream + Video Stream -> MP4Muxer 

x264是免费开放源代码,拥有良好的MP4Muxer,但不合法,您必须拥有专利许可在你的代码中使用H264。

x264 is free open source and has a good MP4Muxer but not legal, you must have patent licenses acquired for using H264 in your code.

替代品是你可以使用大量的商业控制,英特尔的IPP是迄今为止H264的最佳实现,它在directshow。

Alternatives are you can go with lots of commercial controls, Intel's IPP is the best implementation of H264 so far, but its little tricky to put it in directshow.

这篇关于如何将视频从网络摄像机编码为​​C#中的H.264?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆