I have a simple opencv
program to save a video from my USB
camera. Camera has few supported resolutions
1600x1200 <= 5fps
1280x720 <= 11.120fps
800x600 <= 20fps
640x480 <= 30fps
I'm using it this way: (It's just a strip from my code)
cam = cv2.VideoCapture(0)
width = int(cam.get(cv2.CAP_PROP_FRAME_WIDTH))
height = int(cam.get(cv2.CAP_PROP_FRAME_HEIGHT))
fps = cv2.CAP_PROP_FPS
cam.set(3, width)
cam.set(4, height)
fourcc = cv2.VideoWriter_fourcc(*"mp4v")
out = cv2.VideoWriter(file_name, fourcc, fps, (width, height))
while cam.isOpened():
img = cam.read()[1]
out.write(main_img)
# etc....
This is saving my video as 1600x1200 5fps
in daytime and also in night with real time speed.
But when I do something like this
cam = cv2.VideoCapture(0)
width = 1280
height = 720
fps = 11.120
# ....
I'm getting video 1280x720 11.120fps
in daytime and also in night, but in night my video getting faster! Like fast-forwarding, 1 sec takes 0.5 sec and everything in the video is moving faster.
How could I avoid this? Is it because my camera is too sh*tty and can't get faster shutter speed at night so cv2
to persist11.120 fps
fast-forwarding the video?
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…