Skip to content

fix: list the frame rates DirectShow devices support besides the default one - #189

Merged
kekyo merged 1 commit into
kekyo:developfrom
Roman3349:fix/directshow-frame-rates
Nov 9, 2026
Merged

kekyo merged 1 commit into
kekyo:developfrom
Roman3349:fix/directshow-frame-rates

Conversation

@Roman3349

Copy link
Copy Markdown
Contributor

On DirectShow, FlashCap lists each format of a device with its default frame rate only. A webcam which records a format at more frame rates, such as 1280x720 MJPEG at 60 and 30 fps, is listed with 30 fps only, so the higher frame rates cannot be selected. V4L2 lists all of them for the same webcam.

Related: #52

@insam125, this looks like the missing 60 fps of your StreamCam. Could you try this branch?

Cause

IAMStreamConfig::GetStreamCaps returns one entry per format, with the default frame interval in AvgTimePerFrame and a range in MinFrameInterval / MaxFrameInterval. FlashCap used AvgTimePerFrame only. The range is not usable by itself, UVC devices support only some intervals in it.

Changes

  • The frame intervals a device supports for a format are read with IAMVideoControl::GetFrameRateList of the capture filter, as OBS does. Each format is listed with its default frame rate and the other supported ones.
  • DirectShowDevice sets the frame interval of the selected characteristics in AvgTimePerFrame of the format passed to IAMStreamConfig::SetFormat.
  • A device without IAMVideoControl, or without the list, is listed with the default frame rate as before.

IAMVideoControl is declared in NativeMethods_DirectShow.

Testing

  • Builds for all target frameworks (net35 ... net10.0) without warnings.
  • Logitech C922 Pro Stream Webcam on Windows 11, .NET 10:
    • The characteristics of 1280x720 MJPEG are 60, 30, 24, 20, 15, 10, 7.5 and 5 fps, the same as V4L2 lists on Linux. Before, there was 30 fps only. The other formats got their lower frame rates too, 218 characteristics in all.
    • After opening 1280x720 MJPEG at 60 fps, the connected media type of the sample grabber has AvgTimePerFrame 166666 (60 fps), at 30 fps 333333.
    • This C922 delivered about 30 fps in the 60 fps mode, with a short manual exposure. It does the same on Linux with V4L2 (v4l2-ctl --set-parm=60 reports 60 fps, the stream has 29.7 fps), so I could not measure 60 fps frames with it. A device which does deliver them would help, see the request above.

@kekyo
kekyo self-requested a review November 9, 2026 03:01
@kekyo

kekyo commented Nov 9, 2026

Copy link
Copy Markdown
Owner

LGTM, I will merge it, thanks!

@kekyo
kekyo merged commit fbcc34e into kekyo:develop Nov 9, 2026
@Roman3349
Roman3349 deleted the fix/directshow-frame-rates branch November 9, 2026 05:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants