How can I stream video from a webcam using C #?

I want to create a simple server application where people can connect using a client browser (which I will do later) to watch streaming video. And I want to use C #.

What do I need to capture video or fast images through a webcam and send them over the network?

+49
c # video streaming webcam
Dec 05 '08 at 2:54
source share
6 answers

If you need the capture / streamer in box component, there are a few others others have talked about.

If you want to move on to low-level management over all of this, you'll need to use DirectShow, as thealliedhacker points out. The best way to use DirectShow in C # through the DirectShow.Net library is that it wraps all the DirectShow COM APIs and includes many useful shortcuts for you.

In addition to capturing and streaming, you can also convert recordings, audio and video formats, real-time audio and video filters and much more.

Microsoft claims that DirectShow is leaving, but they have not yet released a new library or API that does everything that DirectShow provides. I suspect that many of the last things they released are still DirectShow under the hood. Due to its status with Microsoft, there are not many books or links on it other than MSDN, and what you can find on the forums. Last year, when we started using this project, the best book on this subject was unprintable and collected about $ 350 for a used copy!

Here is a book: Microsoft DirectShow Programming . You can get a new copy (at the time of publication) for $ 299 or a used copy for $ 149 on Amazon!

alt text http://www.lmet.fr/www.lmet.fr/icons/Scans13/Big/9780/73/56/18/213.gif

+19
Dec 05 '08 at 22:48
source share
β€” -

The usual API for this is DirectShow.

You can use P / Invoke to import the C ++ API, but I think there are already a few projects that have done this.

http://channel9.msdn.com/forums/TechOff/93476-Programatically-Using-A-Webcam-In-C/

http://www.codeproject.com/KB/directx/DirXVidStrm.aspx

To get the streaming part, you probably want to use DirectShow to apply a compression codec to reduce latency, then you can get Stream and stream it. You might consider using multicast to reduce network load.

+6
Dec 05 '08 at 22:20
source share

You can just use VideoLAN . VideoLAN will act as a server (or you can wrap your own C # application around it for more control). There are also .NET wrappers for the viewer, which you can use and thereby implement C # in your client.

+4
Feb 04 '09 at 17:22
source share

I used VideoCapX for our project. It will be broadcast as an MMS / ASF stream, which can be opened by a media player. You can then embed the media player on your web page.

If you don’t need a lot of control or if you want to try VideoCapX without writing code, try U-Broadcast , they use VideoCapX behind the scenes.

+3
Dec 05 '08 at 8:16
source share

If you want to record video from a web browser, I think that your only option is Flash. We are looking for the same. We are also mostly .NET-house, and I see no way to use .NET to capture _from_within_the_browser_ webcam. All of the other solutions mentioned here will probably work just fine if you are happy to agree to the desktop application.

+1
Mar 27 '12 at 21:05
source share

Another option for streaming images from a webcam to a browser is via mjpeg. This is just a series of jpeg images that most modern browsers support as part of the tag. Here is an example server written in C #:

https://www.codeproject.com/articles/371955/motion-jpeg-streaming-server

This works well on a local network, but not on the Internet, since mjpeg is not as effective as other video codecs (h264, VP8, etc.)

0
Dec 06 '16 at 16:08
source share



All Articles