views:

400

answers:

3

I am trying to figure out what APIs to use to connect and record from a webcam. In al of my research, Google, I have found many OLD articles which discus Directshow and COM. I don't want to write code that is using an obsolete API.

Any direction with this is greatly appreciated.

+1  A: 

DiectShow is still the best way to connect to Webcams (or other sources).
You can use DirectShow.NET which is a thin warpper arund DirectShow.

Shay Erlichmen
+1  A: 

If you are using Vista, you can use the new Media Foundation APIs. But, they are not available on XP, so DirectShow is the way to go. The DirectShow.NET wrapper pointed to by Shay works great with C#. Be sure to also download the Samples, there are several capture samples worth checking out like PlayCap and CapWMV.

UberDemo wrote an article about another way of capturing using the Windows Media Encoder SDK with WPF in this article.

Jeff Youel
+1  A: 

avicap32.dll I guess is the safest option due to its readily availability... http://channel9.msdn.com/forums/TechOff/93476-Programatically-Using-A-Webcam-In-C has the PInvoke code you will be needing.

http://codeplex.com/touchless is an interesting related project!

Khurram Aziz