Extrenal webcam show black screen with WPFMediaKit

1.3k views Asked by At

I'm using WPFMediaKit to show a live stream from a webcamera. I'm running my application on a Surface Pro 3 (which has 2 integrated cameras - front and rear).

I'm trying to get the live feed from an external web cam (Microsoft LifeCam Studio), but when i'm changing the VideoSource to my external webcam i see black screen (the camera is turned on but there is no feed).

The other built in cameras work well and the camera works fine on other applications (such as skype) so i guess it is an issue with the WpfMediaKit.

Here is my code:

<WPFMediaKit:VideoCaptureElement x:Name="videoCapElement"
    DesiredPixelWidth="320"
    DesiredPixelHeight="240"                                 
    Stretch="Fill"
    HorizontalAlignment="Stretch"
    VerticalAlignment="Stretch"
    FPS="30" />  

videoCapElement.VideoCaptureSource = "Microsoft LifeCam Studio";
videoCapElement.Play();
1

There are 1 answers

0
goobering On

This thread outlines an issue with the WPFMediaKit and YUV-only cameras:

https://wpfmediakit.codeplex.com/discussions/272676

This thread outlines an issue with a Windows Update which removes the RGB24 options from the Lifecam Studio driver:

DirectShow - Microsoft LifeCam Studio - RBG24 format lost

It's going to be difficult for me to test this without replicating your setup, but I think it's plausible that your Lifecam Studio has lost its RGB24 option. The user pc25 posted a response (May 9, 2014 at 10:10 PM) in the codeplex thread above which suggests changes to WPF MediaKit's VideoCapturePlayer.cs which should correct the issue. Those alterations are too extensive to post in full here, but pc25 summarises his approach:

Turned out that my camera was not able to stream in rgb (only yuv2 and some other format). In my case SampleGrabber could not connect to output pin of camera, because format mismatch (SampleGrabber wants RGB24). My modification detects if there is YUV2 format on output pin and add sample grabber before renderer and DirectShow automatically adds colour space conversion block.