First some background details: I am running Octoprint as a docker instance on an QNAP NAS and everything else works fine. The Tapo is an IP webcam and annoyingly it only outputs a RTSP stream, so to get it to work with Octoprint I run it through ReStreamer which is also run as a docker instance.
ReStreamer outputs a video URL and a snapshot URL, both of which work fine in a web browser. The video stream URL also works fine in Octoprint for the webcam stream, but the snapshot does not, when testing it I get the error "Could not retrieve snapshot URL"
Having read a lot of posts on similar issues I think the problem is IP address being used. Inside my home network and on Octoprint the webcam stream is accessed via: http://192.168.1.113:8090/hls/live.stream.m3u8 this works.
The snapshot URL which works in a web browser is: http://192.168.1.113:8090/images/live.jpg but that doesn't work in Octoprint and one post I found suggested that as it is running on the same computer that I should use an IP address of 127.0.0.1 instead - that didn't work either, possibly because both Octoprint and ReStreamer are running in docker I think that complicates matters.
Does anyone have any suggestions?
I would have included the webcam log '/var/log/webcamd.log` but it's not in the log folder?
This is probably the reason why. The way the snapshot works is that it's from the perspective of the container itself. This is different from the perspective of the stream URL as that is being accessed by the browser connecting to OctoPrint, and therefore is a client connection direct to that restreamer IP. So access from the OctoPrint container needs to be able to access the IP of the restreamer container. I don't know how this works overall within docker itself, but hopefully that will help you find a solution. IIRC docker gives internal IPs to the containers and you might be able to set the IP for the snapshot to that internal IP.
Good news, I managed to make it work - I created a single docker compose file with both octoprint and restreamer added as individual services. This meant that they shared a docker network stock and were able to communicate with one another.
I added a 'depends_on' entry to the octoprint service stating that it depended on the re streamer service.
Hey I'm running octo from a Ubuntu server VM in a qnap ts451 since I couldnt find a way to config the USB port to docker. How did you do? Also do you have the annoyance of having to reconnect each time the USB whenever you switch off the printer? Thanks
Apologies for reviving an old thread if it's considered inactive, but I wanted to share a quick solution to the issue of connecting OctoPrint and Restreamer when both are running via Docker. The problem, as you already mentioned, was that each container was on a different subnet.
To resolve this, I created a new Docker network that acts as a bridge between the two containers:
docker network create --driver bridge octo2restream
docker network connect octo2restream {CONTAINER ID 1}
docker network connect octo2restream {CONTAINER ID 2}
Now, if you run ifconfig inside the containers, you'll see that both have a new network interface. You can use the new IP address of the Restreamer container to access the snapshots!