Ask Your Question

Revision history [back]

get specific frame from m3u8 stream using opencv

Hello!

I'm new to OpenCV and read that it handles streams, videos pretty well. I installed it on my raspberry pi and I'd like to know if I can solve this using OpenCV or are there easier ways? I would like to grab specific frames from a livestream webcam that has m3u8 extension.

My first try:

import cv2

VIDEO_URL = "http://stream.*playlist.m3u8"

cam = cv2.VideoCapture(VIDEO_URL)

total_frames = cam.get(1)

cam.set(1, 10) ret, frame = cam.read() cv2.imwrite('\home\pi\Desktop\codes', frame)

Thanks in advance.