[英]Extrenal webcam show black screen with WPFMediaKit
I'm using WPFMediaKit
to show a live stream from a webcamera. 我正在使用
WPFMediaKit
来显示来自网络WPFMediaKit
的实时流。 I'm running my application on a Surface Pro 3 (which has 2 integrated cameras - front and rear). 我在Surface Pro 3(具有2个集成摄像头-前后)上运行我的应用程序。
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). 我正在尝试从外部网络摄像头(Microsoft LifeCam Studio)获取实时提要,但是当我将
VideoSource
更改为外部网络摄像头时,我看到黑屏(相机已打开但没有提要)。
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
. 另一个内置的摄像头效果很好,并且该摄像头在其他应用程序(例如skype)上也可以正常工作,所以我想这是
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();
This thread outlines an issue with the WPFMediaKit and YUV-only cameras: 该线程概述了WPFMediaKit和仅YUV相机的问题:
https://wpfmediakit.codeplex.com/discussions/272676 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: 该线程概述了Windows Update的一个问题,该问题从Lifecam Studio驱动程序中删除了RGB24选项:
DirectShow - Microsoft LifeCam Studio - RBG24 format lost DirectShow-Microsoft LifeCam Studio-RBG24格式丢失
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. 如果不复制您的设置,我将很难进行测试,但是我认为Lifecam Studio丢失了RGB24选项是合理的。 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.
用户pc25在上面的codeplex线程中发布了一个响应(2014年5月9日,10:10 PM),该响应建议对WPF MediaKit的VideoCapturePlayer.cs进行更改,以解决此问题。 Those alterations are too extensive to post in full here, but pc25 summarises his approach:
这些更改过于广泛,无法在此处完整发布,但是pc25总结了他的方法:
Turned out that my camera was not able to stream in rgb (only yuv2 and some other format).
原来,我的相机无法以rgb(仅yuv2和其他格式)进行流式传输。 In my case SampleGrabber could not connect to output pin of camera, because format mismatch (SampleGrabber wants RGB24).
在我的情况下,SampleGrabber无法连接到相机的输出引脚,因为格式不匹配(SampleGrabber需要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.
我的修改是检测输出引脚上是否存在YUV2格式,并在渲染器和DirectShow之前自动添加样本采集器,并自动添加色彩空间转换块。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.