1

I am using DirectShow.Net v2.1 to preview the webcam's image.

It works ok, but on some newer webcams like Logitech C920, which is full HD 1080p, it shows black screen instead of webcam's image.

My project is in C# WinForms and compiled with .Net v2.0 I want to run my project on Windows XP / 7 / 8 / 8.1

Can anyone help me how to fix it?

Matin Lotfaliee
  • 1,745
  • 2
  • 21
  • 43
  • When you work with DirectShow, you need to tell effective filter graph topology in use. Without this, without error codes, the troubleshooting is shooting in the dark. – Roman R. Jul 22 '14 at 08:44
  • @RomanR. I am not that much expert in hardware... where can I find a good sample about your comment? – Matin Lotfaliee Jul 22 '14 at 09:02
  • See [this](https://workspaces.codeproject.com/jarno-burger/webcam-using-directshow-net) from "This will add our graph to the running object table", and then this: [Loading a Graph From an External Process](http://msdn.microsoft.com/en-us/library/windows/desktop/dd390650). – Roman R. Jul 22 '14 at 09:06
  • @RomanR. Well, It looks pretty complicated for me. I should change the code? or the OS of the users? or should I build extra files that are needed to be attached to my code? Why the DirectShow by itself did not used effective filter graph topology that I have to do it? – Matin Lotfaliee Jul 22 '14 at 09:44

2 Answers2

0

Replacing DirectShow.Net with WIA using this sample is the solution.

WIA meets the requirements better because:

  1. Not focusing on Windows Vista, which does not seem to capture webcam in its WIA.
  2. Preview does not need to modify, take a picture, take a video of it.
  3. It looks much more easier to use.
  4. The project will be very lighter.
  5. Works with all cameras.
  6. Gives you built-in camera selection by OS.
Matin Lotfaliee
  • 1,745
  • 2
  • 21
  • 43
  • WIA does not do video, has limited support for hardware. – Roman R. Jul 22 '14 at 08:43
  • @RomanR. In action, replacing WIA with DirectShow.Net fixed my problem. do you think it may misbehave on other devices? – Matin Lotfaliee Jul 22 '14 at 09:04
  • Depends on what class of devices/hardware you are interested in. The APIs are not interoperable. WIA for stills, DirectShow for video/streaming/cameras. – Roman R. Jul 22 '14 at 09:07
  • @RomanR. Well i don't want to use webcam in a very professional way. I just want to show the users that their camera is working alright and it is connected. – Matin Lotfaliee Jul 22 '14 at 09:47
0

The issue with Logitech C920 could be solved easily. Just by force another resolution. Think that 19 resolution could be possible for this camera so just put this line before :

VideoSource.Start

YourSourceVideoName.VideoResolution = YourSourceVideoName.VideoCapabilities(X)

X is an integer reagrding to an array: 0 the less resolution and 18 the higher one. Try with 0, you will see that the camera start with image. Then try higher and higher until no image.

Vishal Yadav
  • 1,020
  • 4
  • 15
  • 30
Mika
  • 11