Md. Rezwanul Haque
Md. Rezwanul Haque

Reputation: 2950

How to set fps for extracting frames from a video?

I have a video around 30 fps. I want set fps rate to 70 manually with cap.set(cv2.CAP_PROP_FPS, int(fps_num)). But it always gives False as an output. How can I fix this issue?

import cv2
fps_num = 70

file = "./test.mp4"
cap = cv2.VideoCapture(file)
cap.set(cv2.CAP_PROP_FPS, int(fps_num))

output: False

Upvotes: 0

Views: 79

Answers (1)

Burak
Burak

Reputation: 2495

You are reading from the stream. You can get the FPS rate of the original video. If you want to set the FPS rate, that means you want to write an output stream. See cv::VideoWriter.

Upvotes: 1

Related Questions