3

I got a blunder as depicted beneath when I endeavor to stream ipcam

"[tcp @ 000000000048c640] Port missing in uri warning: Error opening file (/build/opencv/modules/videoio/src/cap_ffmpeg_impl.hpp:901)"

import numpy as np
import cv2
cv2.__file__
cap = cv2.VideoCapture('http://admin:password@http://192.168.1.***/')
#cap = cv2.VideoCapture('https://www.youtube.com/watch?v=Mus_vwhTCq0')

while(True):

    ret, frame = cap.read()
    try:
     cv2.resizeWindow('Stream IP Camera OpenCV', 120300, 800)
     cv2.imshow('Stream IP Camera OpenCV',frame)
    except  Exception as ex:
        template = "An exception of type {0} occurred. Arguments:\n{1!r}"
        message = template.format(type(ex).__name__, ex.args)
        print  (message)

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

cap.release()
cv2.destroyAllWindows()
nathancy
  • 42,661
  • 14
  • 115
  • 137
Step In
  • 31
  • 1
  • 4

2 Answers2

0

First open VLC player and ensure your ipcam stream link is working. If it works, we can now check if OpenCV can connect to the camera with isOpened() and check the frame retrieval status:

while True:
    if cap.isOpened():
        ret, frame = cap.read()
        if ret:
            # Process here
nathancy
  • 42,661
  • 14
  • 115
  • 137
0

Start with making the url working in VLC. Try this website to get a working link/port/user/password combination that works for you camera.

Jannick Breunis
  • 195
  • 2
  • 14