Raspberry Pi USB Camera Logitech C920 lag more than 7-8 sec

I have this problem on my Raspberry Pi 3 (SD image 0.80.3 v6)
- global network lag ~7-8 sec
- local network this lag less ~1-2 sec
- HDMI display no lag

Comments

  • Is pi 3 connected with wifi or ethernet? We already had users where pi cam connected with wifi lagged while ethernet did not lag. Seems like some network operations get too slow.But so far no reports for usb webcams. What resultion/framerate are you using? High resolution needs better network.
  • edited March 2017
    1. connected thru WiFi (Apple router near Pi ~2m direct visibility)
    2. 640x480 15 FPS

    I tested similar configuration with Octoprint - no lags at all.

    P.S. It's Pro version of Server (I bought license)
  • Octoprint does not proxy the webcam. I guess if you call the webcam url directly you also have no delay. For some reason wifi connection seems to be involved here. What url did you enter in server webcam config? using 127.0.0.1 or official ip?
  • I think the problem is a slow wifi connection. Since we proxy we do not drop frames on slow internet connection like a direct connection would probably do. So the proxy adds a delay to it and that increases over time. Just tested this theory with chrome where you can throttle speed and in deed at some point it started to add a delay to the video. mjpg_streamer does the same but seems also to drop a frame every now and then to better stay within limits. So I guess we need to check for the backqueue and drop frames if not catched already to prevent this.
  • I know mjpg_stream has a lot of options. Where I can tune their in Repetier Server? 
  • If you use latest image in printer config you could change resolution or framerate. At some level it will stop lagging.

    For next release I have an idea how I can also remove most of the lag and autodetect slow or full connections to reduce the effect. Then you cat have your 15 frames back and when connection is not 50MBit it will drop some frames to not lag and on fast it will show all. This becomes practical if you check from outwards then with even slower connection.

    Alternative connect with ethernet to pi then you get much better rates and no problems at all.
  • Thank you for the answers! 
Sign In or Register to comment.