Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Record a video via a usb WebCam in csharp

Tags:

c#

webcam

I have a simple use case. Where I want to display a usb webcam and record the the live video(Not as screen capture). I have checked these links

1) WebCam

2)Simple Webcam

But it does not show how to record a video. Can I extend these to record a video or should I look at some other dll ?

Edit: Currently I am using Expression encoder SDK, but is giving a issue with a specific use case (Question)

like image 220
Akash Deshpande Avatar asked Aug 06 '13 05:08

Akash Deshpande


1 Answers

Video capture APIs in Windows are:

  1. Video for Windows (simple, limited, deprecated, really outdated)
  2. DirectShow
  3. Media Foundation

All three are native APIs, so you need wrappers to interface from managed code. #3 is supposed to be a successor to #2 but reality makes #2 still the best - in general terms - API for video capture out there. In particular, Expression Encoder uses DirectShow.

DirectShow.NET lets you do DirectShow from C#, and it has CapWMV Sample for you:

Capture from video capture devices to WMV files.

MFCaptureToFile Sample shows you ho to achieve video capture via Media Foundation:

Shows how to capture video from a video camera to a file.

like image 133
Roman R. Avatar answered Sep 26 '22 04:09

Roman R.