可以使用 Python 库中的 OpenCV 和 ffpyplayer 进行视频抽帧。
- 使用 OpenCV: ``` import cv2
Open the video file
video = cv2.VideoCapture("path/to/video.mp4")
Get the frames per second (fps) of the video
fps = video.get(cv2.CAP_PROP_FPS)
Get the total number of frames in the video
num_frames = int(video.get(cv2.CAP_PROP_FRAME_COUNT))
Choose the interval for frames to be extracted (e.g. every 10th frame)
frame_interval = 10
Initialize a counter for the current frame
current_frame = 0