简体   繁体   中英

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

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 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM