Using opencv to open a IP Cam http stream on Windows
I wrote the following Python code:
import cv2
cap = cv2.VideoCapture()
cap.open("http://<user>:<password>@<ip>/mjpeg.cgi?user=<user>&password=<password&channel=0")
while (cap.isOpened()):
ret, frame = cap.read()
cv2.imshow('frame', frame)
if cv2.waitKey(1) & 0xFF == ord('q'):
break
The code works fine on Linux, but on Windows, I got the following error:
$ python renderer.py
warning: Error opening file (/build/opencv/modules/videoio/src/cap_ffmpeg_impl.hpp:808)
warning: http://<user>:<password>@<ip>/mjpeg.cgi?user=<user>&password=<password&channel=0 (/build/opencv/modules/videoio/src/cap_ffmpeg_impl.hpp:809)
I suspect there's something wrong with my Windows opencv build, but couldn't figure out what. Please let me know if you have any ideas. Thanks.
make sure, opencv_ffmpeg64.dll is on your PATH
I do have opencv_ffmpeg340_64.dll in my path. Also, the code works on Windows if I specify a mp4 file instead of an URL. It also works with the built-in webcam if I specify an index of 0 instead of the URL. Thanks.
Do you have the solution for this? I also face similar issue