I can't achieve higher resolution without experiencing a drop in FPS

I am unable to use a camera at its full capacity with either the OpenCvSharp or Emgu.CV library in C# .NET Framework. Setting the resolution to the camera’s maximum possible resolution doesn’t work, and with two different cameras that natively support 60FPS (Logitech C920 and Razor Kiyo Pro), I can only achieve a maximum of 30FPS. Here’s what I’ve tried so far in terms of settings:


  • DSHOW: Provides the highest possible resolution but only at 30FPS instead of 60.
  • MSMF: With 1080p, it drops to only 5FPS, and with 720p, to 10FPS. Setting the codec to MJPG with the C920 camera isn’t possible.

It seems to me that MSMF doesn’t work well at all, neither with OpenCvSharp nor with Emgu.CV. On the other hand, the integrated Windows Camera app can perfectly control all cameras, so I’m ruling out driver and hardware issues. Disabling settings with Logitech’s gaming software, such as turning off light compensation, etc., hasn’t helped either.

If anyone has managed to get everything out of their HD cam at 60FPS using VideoCapture, I’d be very curious to know how they did it.

the usual issue. everyone’s been asking about it ever since consumer webcams reached those resolutions.

set CAP_PROP_FOURCC to MJPG. try setting that first and last among all the properties.

Setting FourCC as the last option worked (previously I only found the advice to set it first), but regardless of its order, the FPS still cannot be set to 60FPS. And setting the backend to MSMF results in no images at all.

put opencv aside for a moment. can you set the desired properties and get the right video feed in some other program, like OBS Studio?

how about using the native windows apis directly, instead of using OpenCV or Emgu for the device access?

Yes, I can control all the used cameras (Razor, Logitech) with 1080p@60FPS in the Windows app. Additionally, I have tested it on 4 different PCs, Windows 10 and 11. The goal would be to use Emgu.CV in a C# WPF application under .NET Framework 4.8. Unfortunately, it is not possible to switch to UWP or .NET Core. I have tried using Microsoft.Windows.SDK.Contracts, which allows the use of various UWP APIs, but I haven’t really managed to find a viable alternative for video capture. Moreover, this would make everything more complicated and make distribution via ClickOnce more difficult. Or am I seeing this wrong?

Good to hear that the camera and Windows APIs do support the settings you want.

I didn’t say anything about any of the other stuff though. I said to use DSHOW/MSMF APIs yourself, rather than hoping that Emgu or OpenCV will give you proper access.

If I want to use DirectShow in my project, I essentially have to resort to using a wrapper. I’ve tried AForge, which basically does this work for me. But I’m encountering a similar issue there. I could experiment with DirectShowLib, but it can’t be that complicated, can it?

Final Solution:

I have now found an example of how VideoCapture or MediaCapture via UWP Islands and Microsoft.Toolkit.Wpf.Ui.XamlHost is possible under .Net Framework (see GitHub - ondrasvoboda/WPFCamera). I thought this was only possible under .Net Core. Thus, I am now using this approach, which, as it seems, extracts everything from the camera. Thank you for the hint about the native APIs, it ultimately led me to the mentioned solution.