Hello,
I’m working with a live RTSP camera feed in C# (using VideoCapture
) and would like to reduce the incoming FPS for the purpose of detection (for performance optimization). Unfortunately, I can’t change the FPS setting on the camera side.
I initially used Stopwatch.Elapsed.TotalMilliseconds
as a time base to control the frame processing interval, but I found that I was getting around 7-8 FPS when I actually needed 10 FPS. (The Stopwatch doesn’t seem to be very accurate in this scenario.) Basically every time a frame came (ImageGrabbed
event) I wrote down the Stopwatch’s current time and checked time - last_time >= 1000.0 / target_fps
To address this, I tried counting frames and using the formula time = frame_count / fps * 1000
to estimate the current time per frame. This seems to work pretty well.
From what I’ve read, I can also use the CAP_PROP_POS_MSEC
property from OpenCV, but I’m not sure if it works consistently across all camera models and whether this would be a more reliable solution than my current approach.
Is there are other ways to more accurately control FPS?
Thank you for your help!