Saber Amani
Saber Amani

Reputation: 6489

Connect to capture driver without creating window

How can I connect to video capture driver without creating a capture window. Is this possible ? In the other word, I want to capture video from user webcam without showing preview window.

Upvotes: 0

Views: 721

Answers (2)

Deanna
Deanna

Reputation: 24263

Using VfW, you need to (at least) create the video/capture window, but you can give it a null window handle as the parent and make it not visible. All communication from the VfW library is done via StdCall callbacks. I'm not 100% but I don't think you need to run a message pump either.

As Roman says you should look at DirectShow as it obsoleted VfW about 15 years ago now.

Upvotes: 1

Roman Ryltsov
Roman Ryltsov

Reputation: 69642

You need to have a window only with legacy Video for Windows API. With DirectShow or Media Foundation, window is not necessary for video capture. In C# you can interface to those APIs using open source DirectShow.NET and Media Foundation.NET libraries.

FYI: DirectShow.NET includes CapWMV sample in C# that captures video into file.

A .NET sample application using the WM ASF Writer filter to create an wmv file While the underlying libraries are covered by LGPL, this sample is released as public domain. It is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Upvotes: 2

Related Questions