c#中的视频流 [英] video streaming in c#

查看:196
本文介绍了c#中的视频流的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想开发一个窗口应用程序,可以通过网络摄像头连接四个或更多用户。意味着每个用户都可以在他的窗口上看到其他用户的面孔。如何实现这一点。



当我搜索我的许多东西时,我正在修复,该用什么。我创建了xna,direct show,directX和sharpDX。



现在我熟悉c#,WPF,Aforge.net的窗口应用程序。



任何样本或学习链接都将受到赞赏。

谢谢。

i want to develop an window app, where four users or more can be connected through web cam. means every user can see the faces of other users on his window. How to implement that.

when i searched i foud many things, i am in fix, what to use for that. i founded ,xna,direct show,directX and sharpDX.

and now i am familiar with window apps by c#, WPF,Aforge.net.

any sample or links to study will be appreciated.
Thanks.

推荐答案

这是称为视频会议,所以在搜索信息时你应该使用那个术语。



像这样的项目有几个部分。

1 )从摄像头捕获原始视频,从麦克风捕获音频。

2)压缩视频和音频。

3)传输和接收视频和音频。

4)解压缩视频和音频。

5)显示视频和播放音频。



捕捉

Code Project上有几篇关于从网络摄像头捕获视频的文章。我相信他们中的大多数都使用DirectShow。

Chesnokov Yuriy [ ^ ]撰写了精彩的文章关于视频处理,压缩和分析,还有一篇关于视频捕获的文章:使用SampleGrabber在缓冲模式下的视频预览和帧捕获到内存。 [ ^ ]

这是另一篇文章,它真的是关于解决数独谜题,但他确实从网络摄像头捕获视频,我认为值得一看:实时网络摄像头数独解算器 [<一个href =http://www.codeproject.com/Articles/238114/Realtime-Webcam-Sudoku-Solvertarget =_ blanktitle =New Window> ^ ]

以下是另外几篇文章:

使用DirectShow将帧作为位图抓取的简单视频处理框架 [ ^ ]

又一个网络摄像头控制 [ ^ ]



我真的没有很多关于音频捕获的参考资料,但这里有一个让你入门:播放或捕获音频声音。发送和接收多播(RTP) [ ^ ]



压缩音频和视频

有很多音频和视频编解码器,很难将任何特定的编解码器归零。我建议使用H.264进行视频和语音目标音频压缩。我使用过 Speex [ ^ ]过去,但看起来该项目已经结束。

总的来说,我建议使用 FFmpeg [ ^ ]库(不是FFmpeg本身,但是libavcodec,libavformat等图书馆)。使这项工作变得具有挑战性,但有很多功能值得研究。



传输和接收
您没有提及是否希望此会议在组织内部工作,或者是否适用于Internet上的朋友和家人,但为了开发灵活且适用于大多数环境的内容,您需要确定标准协议(如RTP)和视频格式(如H.264)。

RTP是为此目的而创建的,并且是大多数组织IT部门所允许的。如果你试图编写自己的协议,流量很可能最终被某些防火墙阻止。

FFmpeg库也有内置的RTP功能,但我不知道它是否是完全扩展以支持实际的视频会议。



解压缩音频和视频

我再次指出FFmpeg为用于解压缩音频和视频的全功能包。



显示视频和播放音频

如果您通过我在这里链接的文章,多媒体的介绍也或多或少都有。





有一篇很棒的文章这里是为了帮助您入门:在中创建会议系统的示例。 NET,C#VOIP&使用H.323和TAPI 3的视频会议系统 [ ^ ]。



ConferenceXP [ ^ ]是一个视频会议项目,最初由Microsoft和后来开源了。我不知道它是否仍在积极开发中,但它是一个相当大的项目,所以有很多需要研究。



作者我给出的第一篇文章链接也写了一篇关于利用ConferenceXP API构建自己的系统的文章:如何在.NET中使用托管RTP API类来创建多播系统 [ ^ ]





祝你好运。

Soren Madsen
This is called Video Conferencing, so when searching for information you should use that term.

There are several parts to a project like this.
1) Capturing raw video from camera and audio from microphone.
2) Compressing the video and audio.
3) Transmitting and receiving video and audio.
4) Decompressing the video and audio.
5) Displaying the video and playing the audio.

Capturing
There are several articles here on Code Project related to capturing video from web cams. I believe most of them use DirectShow.
Chesnokov Yuriy[^] has written excellent articles on video processing, compression and analytics and also has an article on video capturing: Video Preview and Frames Capture to Memory with SampleGrabber in Buffered Mode.[^]
Here is another article, which really is about solving Sudoku puzzles, but he does captures video from a web cam and I think it is worth looking at: Realtime Webcam Sudoku Solver[^]
Here are a couple more articles like that:
An Easy Video-processing Framework by Grabbing Frames as Bitmaps Using DirectShow[^]
Yet another Web Camera control[^]

I don''t really have a lot of references for audio capturing, but here is one to get you started: Play or Capture Audio Sound. Send and Receive as Multicast (RTP)[^]

Compressing audio and video
There are so many audio and video CODECs, that it can be difficult to zero in on any specific ones. I will recommend using H.264 for the video and a speech targeted audio compression. I have used Speex[^] in the past, but it looks like that project is end of life.
Overall, I will recommend using the FFmpeg[^] libraries (not FFmpeg itself, but the libavcodec, libavformat, etc. libraries). It can be challenging to get this working, but there is so much functionality that it is worth researching.

Transmitting and Receiving
You do not mention if you want this conferencing to work within an organization or if it is for your friends and family on the Internet, but in order to develop something that will be flexible and work in most environments, you need to settle on standardized protocols (such as RTP) and video formats (such as H.264).
RTP was created for this purpose and is allowed by most organizations IT departments. If you try to make up your own protocol, the traffic will most likely end up getting blocked by some firewalls.
The FFmpeg libraries also has built-in RTP functionality, but I do not know if it is fully extended to support actual video conferencing.

Decompressing audio and video
Again I will point to FFmpeg as full-featured package for decompressing audio and video.

Displaying video and playing audio
If you go through the articles I have linked to here, presentation of the multimedia will be more or less covered as well.


There is a great article here to get you started: Examples to create your Conferencing System in .NET, C# VOIP & Video Conferencing Systems using H.323 and TAPI 3[^].

ConferenceXP[^] is a Video Conferencing project originally started by Microsoft and later open-sourced. I don''t know if it is still being actively developed, but it is a fairly large project, so there is a lot to study.

The author of the first article link I gave also wrote an article about utilizing the ConferenceXP API to build your own system: How to use the managed RTP API classes in .NET to create your multicasting systems[^]


Best of luck to you.
Soren Madsen


正如SoMad所说,这称为视频会议。我们使用商业SDK(即leadtools)帮助我们以简单的方式完成此操作,因为我们不熟悉DirectShow SDK。由于leadtools使用DirectShow过滤器,因此很容易创建我们的应用程序。我知道视频会议(服务器和客户端)都附带了示例演示。您可以查看此帮助主题以获取信息:

视频流媒体

如果您需要更多信息,请联系他们的支持团队。
As SoMad said, this is called Video Conferencing. We use a commercial SDK (which is leadtools) that helped us to do this in easy way, since we are not familiar with the DirectShow SDK. Since leadtools uses the DirectShow filters, it was easy to create our application. I know that there are sample demos shipped with it for the video conferencing (both server and client). you can check this help topic for information:
Video Streaming
If you need further information, contact their support team.


这篇关于c#中的视频流的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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