File size: 265 Bytes
be766da
 
 
 
 
57ec7e4
 
be766da
 
57ec7e4
1
2
3
4
5
6
7
8
9
10
11
import cv2

def get_video_frame(video_path):
    cap = cv2.VideoCapture(video_path)
    while cap.isOpened():
        ret, frame = cap.read()
        if not ret:
            cap.set(cv2.CAP_PROP_POS_FRAMES, 0)  # Loop video
            continue
        yield frame