I'm trying to capture video from youtube live stream using this code:
url = "https://youtu.be/mRe-514tGMg"
camera_source = pafy.new(url).getbest()
capture = cv2.VideoCapture(camera_source.url)
while (True):
# Capture frame-by-frame
ret, current_frame = capture.read()
cv2.imshow('frame', current_frame)
cv2.resizeWindow('frame', 1280, 640)
if cv2.waitKey(1) & 0xFF == ord('q'):
break
I want to get the live stream going all the time till i exit, but what i get is just a few second video. Also, when i couldn't find in pafy documentation how to choose other video res than the best. Is there a way to do this?