Closed
Description
Bug summary:
opencv-contrib-python
python library's VideoCapture
class fails to parse https URL received from pafy/youtube-dl
. But strangely this bug doesn't exist on same/different machine with OpenCV installed from scratch.
Affected users:
Users with OpenCV installed with opencv-contrib-python
or opencv-python
python library from PyPi
Non-Affected users:
Users with OpenCV installed from scratch/source-code and not from PyPi (Tested with OpenCV 4.1.0-dev & 3.4.5)
Steps to reproduce
- operating system -
Ubuntu 18.04.1 bionic
- architecture
x64
- opencv-python
4.1.0.25
- youtube-dl
2019.5.20
- pafy
0.5.4
- python_version
3.6/2.7/3.5 tested
Test-Code:
You can copy url
directly to cv2.VideoCapture
class and this result in same Bug.
import cv2
import pafy
video = pafy.new("dQw4w9WgXcQ")
object = video.getbestvideo()
url = object.url
print(url) #means pafy and youtube-dl working correctly
stream = cv2.VideoCapture(url)
# infinite loop
while True:
(grabbed, frame) = stream.read()
# read frames
# check if frame empty
if not grabbed:
print('opencv is buggy')
break
cv2.imshow("Output Frame", frame)
# Show output window
key = cv2.waitKey(1) & 0xFF
# check for 'q' key-press
if key == ord("q"):
#if 'q' key-pressed break out
break
cv2.destroyAllWindows()
# close output window
stream.release()
# safely close video stream.
This code exit instantly with no error on opencv-python 4.1.0.25
since no frame grabbed BUT instead this algorithm works when OpenCV installed from scratch and returns valid frames.
Metadata
Metadata
Assignees
Labels
No labels