title: Connection refused when I am trying to get stream from IP Cam using opencv python
body: <p>I am trying to get the live feed from IP camera using opencv 4.0 python 3.7. I know the IP address of cam and admin and password. I have a camera of "Wifi Smart Camera" company and most probable the URL of camera is in format like this;</p>
  
  <pre><code>rtsp://admin:password@192.168.1.20/live/ch00_0
  </code></pre>
  
  <p>here is the link where I see this info</p>
  
  <p><a href="https://www.ispyconnect.com/man.aspx?n=Wifi+Smart+Net+Camera#" rel="nofollow noreferrer">https://www.ispyconnect.com/man.aspx?n=Wifi+Smart+Net+Camera#</a></p>
  
  <p>Here is my python code</p>
  
  <pre><code>import numpy as np
  import cv2
  
  cap = cv2.VideoCapture()
  cap.open("rtsp://admin:admin123@192.168.4.18/live/ch00_0")
  
  while(True):
       # Capture frame-by-frame
      ret, frame = cap.read()
  
      # Our operations on the frame come here
  
  
      # Display the resulting frame
      if ret:
          cv2.imshow('frame',frame)
      else:
          print("no frame occur")
          break
  
      if cv2.waitKey(1) &amp; 0xFF == ord('q'):
         break
  
  # When everything done, release the capture
  
  cap.release()
  cv2.destroyAllWindows()
  </code></pre>
  
  <p>I am getting this error </p>
  
  <pre><code>no frame occur
  [tcp @ 0x558625a859c0] Connection to tcp://192.168.4.18:554?timeout=0 failed: Connection refused
  </code></pre>
  
  <p>The interesting thing is when I add the port in URL just like below, no error occur but stream is also not extract</p>
  
  <pre><code>cap.open("rtsp://admin:admin123@192.168.4.18:8800/live/ch00_0")
  </code></pre>
  
  <p>One more thing is confusing me. When I access the IP cam using V380 Android App
  I put admin, password and <strong>Device ID</strong> also. See this image.
  <a href="https://i.stack.imgur.com/UOQjg.jpg" rel="nofollow noreferrer">Android App Activity</a>
  I see many stack questions, no one suggest to put Device ID in URL.</p>
  
  <p>how can I access the stream of IP Cam using below information;</p>
  
  <p>admin,
  password, 
  Cam IP add, 
  Device ID.</p>