Frame Rate Issue
There is a issue I'm facing regarding saving a video. I currently have a camera that can capture up to 120fps. When I recorded a 10s video, the video duration was being cut by half and The video looks like it's being sped up.
The specs of my camera: https://m.aliexpress.com/item-desc/32...
I have written my code in python as follow:
import numpy as np
import cv2
cap = cv2.VideoCapture(0)
fourcc = cv2.VideoWriter_fourcc(*'MJPG')
out = cv2.VideoWriter('output004.mjpg',fourcc, 120, (640,480))
while(cap.isOpened()):
ret, frame = cap.read()
if ret==True:
frame = cv2.flip(frame,0)
out.write(frame)
cv2.imshow('frame',frame)
if cv2.waitKey(1) & 0xFF == ord('q'):
break
else:
break
cap.release()
out.release()
cv2.destroyAllWindows()
there is no way to synchronize the videowriter to your input.
if you gave it a playback rate of 120 fps, it will just do that, irrespective of what happened in your camera loop.
so, if your recorded video is running too fast, most likely you did not get 120fps from your cam originally.