title: Receive rtsp stream into Docker container
body: <p>I've been in a war to get this issue resolved. I have the impression that I have already searched the entire internet...
  My goal is to send an rtsp stream from my host (Windows) to a Docker container, to later run machine learning models on the video.</p>
  <p><a href="https://i.stack.imgur.com/oM1BH.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/oM1BH.png" alt="Here is the architecture that seems to me to be the problem." /></a></p>
  <p><strong>Host (Windows):</strong></p>
  <p>Thanks to <a href="https://github.com/aler9/rtsp-simple-server" rel="nofollow noreferrer">rtsp-simple-server</a> I'm able to get my webcam to generate an rtsp stream.
  The rtsp-simple-server.yml looks like (where xxx.xxx.xxx.x is the Windows Host IP):</p>
  <pre><code>paths:
    cam:
      runOnInit: ffmpeg -f dshow -i video=&quot;HP HD Camera&quot; -c:v libx264 -preset ultrafast -tune zerolatency -b:v 600k -f rtsp rtsp://xxx.xxx.xxx.x:8554/cam
      runOnInitRestart: yes
  </code></pre>
  <p>Then I can view the video running a script in python that opens a window for me:</p>
  <pre><code>import cv2
  import os
  os.environ[&quot;OPENCV_FFMPEG_CAPTURE_OPTIONS&quot;] = &quot;rtsp_transport;tcp&quot;
  vcap = cv2.VideoCapture(&quot;rtsp://localhost:8554/cam&quot;, cv2.CAP_FFMPEG)
  while(1):
      ret, frame = vcap.read()
      if ret == False:
          print(&quot;Frame is empty&quot;)
          break;
      else:
          cv2.imshow('VIDEO', frame)
          cv2.waitKey(1)
  </code></pre>
  <p><strong>Docker container:</strong></p>
  <p>Now comes the tricky part: How can I get the stream to the Docker container?
  I am currently using the Docker image: <a href="https://hub.docker.com/r/jjanzic/docker-python3-opencv" rel="nofollow noreferrer">jjanzic/docker-python3-opencv</a> but when I run the python script I get <em>&quot;Frame is empty&quot;</em>... Even changing the <em>rtsp://localhost:8554/cam</em> by the Windows Host IP - <em>rtsp://xxx.xx.xxx.x:8554/cam</em></p>
  <p>Help please </p>