Ask Your Question

Desmond's profile - activity

2017-06-01 04:30:46 -0600 asked a question 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()