I have two problems. The first one is definitely more important to me:
1) The framerate is stable in its arithmetic meaning (number of images per
second). However, if I look at the frames, sometimes I have something like 8
frames from the same second, than maybe 4 seconds are skipped, and then it
actually works at 2FPS, then again it get stucks (many frames from the same
seconds) then it skips some seconds, etc. I am sure about this because in my
video I have the timestamp (it's printed by the camera in the video frames).
So for instance, if I want 2 FPS I should expect the seconds in the frame to
be [0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, etc] while I have something like [0,
0, 0, 0, 0, 0, 4, 4, 5, 5, 5, 5, 7, 7]. Like on the average it is working,
but there are sudden burst and slow. I tried to increase the size of buffer
and latency hoping it could help, but it does not solve the problem
2) In Python, the framerate seems to be 4 FPS according to print. However, I
don't understand why, if I save the frames to a cv2.VideoWriter with 2fps
the framerate seems ok.