我已经开发了一个UWP应用程序,可以从网络摄像头捕获视频并将其保存到UWP的本地存储中,并且该应用程序在本地计算机上运行良好,但是将其部署在RaspberryPi3上后,我得到了
指定的对象或值不存在
文件正在保存到应用程序的localData中。调试后,我知道错误在以下几行:
MediaEncodingProfile recordProfile = null;
recordProfile = MediaEncodingProfile.CreateWmv(VideoEncodingQuality.Auto);
await _mediaCapture.StartRecordToStorageFileAsync(recordProfile, recordStorageFile);
_statuses.Add(DateTime.Now.ToString() + ": " + fileName + " Recording in progress");
任何帮助,将不胜感激。
最佳答案
The issue maybe due to your USB camera has no micro phone, but the default capture mode is video and audio.
因此,在调用MediaCapture.InitializeAsync()之前,您需要将StreamingCaptureMode设置为Video,如下所示:
var settings = new Windows.Media.Capture.MediaCaptureInitializationSettings();
settings.StreamingCaptureMode = Windows.Media.Capture.StreamingCaptureMode.Audio;
await mediaCapture.InitializeAsync(settings);
关于c# - 指定的对象或值不存在,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/40819237/