viep-fault-detection / services /video_service.py
Sanjayraju30's picture
Update services/video_service.py
be766da verified
raw
history blame
265 Bytes
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