title: Coonnect to IP camera Dahua
body: <p>I need to connect to ip camera using Python.
  I am trying to do it like this:</p>
  
  <pre><code>import cv2
  
  if __name__ == "__main__":
      cv2.namedWindow("original")
      cap = cv2.VideoCapture("&lt;URL&gt;")
      while True:
          flag, img = cap.read()
          try:
              cv2.imshow("original", img)
          except:
              cap.release()
              raise
  
          ch = cv2.waitKey(5)
          if ch == 27:
              break
  
      cap.release()
      cv2.destroyAllWindows()
  </code></pre>
  
  <p>I do not have direct access to the camera.<br/>
  I have IP, port, username, password. <br/>
  Model is Dahua <code>DH-XVR4116HS-X</code>.<br/>
  I can't find the correct url. <br/>
  I have tried <code>rtsp://&lt;username&gt;:&lt;password&gt;@&lt;ip&gt;:&lt;port&gt;/cam/realmonitor?channel=&lt;channelNo&gt;&amp;subtype=&lt;typeNo&gt;</code> format but didn't get a result.<br/>
  Do I need to enable multicasting?</p>