首先确认下视频的播放时间
使用cv库来获取帧率和帧数,测试代码如下
import cv2
cap = cv2.VideoCapture("xxx.mp4")
if not cap.isOpened():
print("Cannot open camera")
exit()
# get default video FPS
fps = cap.get(cv2.CAP_PROP_FPS)
# get total number of video frames
num_frames = cap.get(cv2.CAP_PROP_FRAME_COUNT)
print("fps is %d , sum of frames is %d " % (fps, num_frames))
cap.release()
cv2.destroyAllWindows()
python3运行结果,30fps,总帧数807
视频讲解