-
Notifications
You must be signed in to change notification settings - Fork 277
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Docker container needs a restart when camera signal was lost for a short time #461
Comments
It may be related to #368 Could you provide log data? |
I also noticed the behavior described in #368 it also happens when I plug it in right after starting the container. I will try to provide a log tomorrow. |
Steps:
Log:
|
Thanks for the logs. I can't tell if Darknet is running or not. Would you mind trying one more thing: After you reconnected the camera and you have the Darknet logs on the console, can you try accessing ports 8070 or 8090 to access Darknet directly? |
maybe due to 8080 already being yoinked at time of error and mjpeg being ad hoc? |
It looks like both connections are not available anymore. On 8090 I was getting this error message for a second an then it was not reachable anymore:
|
Thank you @AlexHolly. That would indicate that Darknet is not starting up any more and would be a different error then #368. Last question, which Version of ODC are you running? |
It should be this one 7c79544 |
I tested it again. Maybe I missed this message previously. When I disconnect the IP Camera for ~2 seconds I get this message.
Any idea where I should look to fix this? |
that looks like what i talked about. connreset for the 1-1 mjpeg conn and then it will die. |
@AlexHolly When you disconnect the camera, the Darknet process stopps (which is expected) and then ODC complains about that the Video stream stopped (which is also expected). What should happen then is that ODC tries to start the Darknet process again and once Darknet is running it should connect to Darknet. Obviously this is not happening. What I don't know is if this is because Darknet is not running, OR because ODC fails to re-connect to Darknet. What you can do to help me debug this is:
If you see something in your browser that means that Darknet restarted successfully and ODC is not connecting to it. If you don't see anything it means that Darknet did not restart. Here we'd need additional logs from you to understand why it did not restart. Let me know if this works otherwise feel free to ask again :-) |
Actually We have encounter this problem on the past, but this is a darknet issue. If you do manually a test, and stop/interrupt the camera video (regardless of what is the feed) and reconnect the feed darknet remains disconnected therefore, ODC will remains without input from darknet and nothing works. A simple thing is to restart darknet and all works again. Having a logic to check the feed and restart darknet when this happens is a workaround for this problem. |
@vsaw I tested exactly this and you can see the result here.
@rantgithub Can I restart darknet with a 'exec' command from ODC? |
@AlexHolly Sorry I mussed have missed this then. This indicates that the Darknet process is not restarting. I can't really tell why without additional logs. Do you have any logs that show Darknet's or gstreamer output? |
@vsaw It looks like after connecting the camera again, darknet (8070) is reachable for a few seconds but mjpeg (8090) is not. As a workaround I added a script to restart the node.js process in case of such an error. mjpeg then works but there are still some timing issues with /start and /recording/start |
@AlexHolly I currently don't have any HW so I can not investigate the issue any further. I can however offer you another workaround: Darknet inside docker can be configured to accept UDP Streams. You can then create a quick shell script to stream the USB-Camera via UDP to Darknet inside docker. This allows you to restart the UDP Stream independently of Darknet and Docker. See also https://gstreamer.freedesktop.org/documentation/udp/udpsink.html?gi-language=c#udpsink and https://gstreamer.freedesktop.org/documentation/udp/udpsrc.html?gi-language=c#udpsrc |
@vsaw How can I configure Darknet Docker to accept UDP. I can only see this PR but it was never merged AlexeyAB/darknet#1976 |
As Darknet can take images from any Gstreamer pipeline we don't need to hack Darknet. Instead we will configure the GST pipeline. The process has three steps. Step 1 Preparing ODCI usually use something like this in my ODC configs
Step 2 - Configuring Port ForwardingNow when you start the Docker container make sure that you forward UDP Port 7001 to ODC. You can skip this step if you don't use Docker. See the Docker Documentation on port Forwarding, but it should work a little something like this:
Step 3 - Stream video via UDPNow you should have ODC running in the background waiting for a UDP stream. You can stream your USB-Webcam to ODC when you run the following command in a different terminal
It may be the commands contain some typos or other errors but in general this is I've been using it. The great advantage is you can stop and start the command from Step 3 any time you want. From the point of ODC this is like having a frozen picture, but it does not crash ODC 😉 |
@vsaw Do you know how to make it run on a Desktop? The plugin https://forums.developer.nvidia.com/t/nvjpegenc-on-dgpu-platforms/84126
|
You can run it without the |
@vsaw It works like you described, but when I unplug the camera it will have a different video source (/dev/video0 or video1) and I have to rerun
My main use case is an Ip-Cam. Here I get at least a return value after a few seconds I will try tomorrow to automate the whole process and check if it is reliable:
Config:
|
@vsaw I created a systemd service for the Error: |
This is a bug in MJPEG Proxy. It is just "cosmetic" the counting logic is not affected. We've discussed fixing it in #492 |
Ok, I followed the discussion on #492. If it is just cleaning up by adding 99999 retries without the config. I could give it a try this weekend. Thank you for your help, feel free to close this issue. |
If I remember correctly that's not enough. We discussed listening to the close event in the MJPEG Proxy. However I don't know what happens in your case with the UDP Stream config. |
Version https://github.com/opendatacam/opendatacam/tree/db78e881097619616a5cb1e94b68abc3178c6798
When I unplug the camera for a short time (happens for both IP and USB) I have to restart the docker container otherwise the signal is never found again.
Anyone else has this issue or knows a solution?
The text was updated successfully, but these errors were encountered: