Skip to content

Python: YouTube livestream not working with Streamlink #193

Closed
@devanshusharma19

Description

@devanshusharma19

Expected behaviour

opencv working with youtube stream or youtube videos

Actual behaviour

actually it is not working it is showing error. I have tried on browser that link. It is working fine but in opencv is not working.

cv2.error: OpenCV(4.0.1) /io/opencv/modules/highgui/src/window.cpp:352: error: (-215:Assertion failed) size.width>0 && size.height>0 in function 'imshow'

Steps to reproduce

  • example code
import streamlink
import cv2

url = 'https://www.youtube.com/watch?v=bZ6NL59FMoc'

streams = streamlink.streams(url)
print(streams)
#cap = cv2.VideoCapture(streams["360p"].url)
cap = cv2.VideoCapture(streams["best"].url)

while True:
    ret, frame = cap.read()
    print(frame)
    cv2.imshow('frame', frame)

    if cv2.waitKey(1) & 0xff == ord('q'):
        break

cap.release()
cv2.destroyAllWindows()
  • operating system

Ubuntu 18.04

  • architecture (e.g. x86)

64 bit
python 3.6

  • opencv-python version

opencv-python version 4.0.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions