Search code examples
nginxreverse-proxyopenwrt

How do I use nginx to reverse-proxy an IP camera's mjpeg stream?


I'm using nginx on OpenWRT to reverse-proxy a motion-jpeg feed from an IP camera, but I'm experiencing lag of up to 10-15 seconds, even at quite low frame sizes and rates. With the OpenWRT device removed from the path, the camera can be accessed with no lag at all.

Because of the length of the delay (and the fact that it grows with time), this looks like some kind of buffering/caching issue. I have already set proxy_buffering off, but is there something else I should be watching out for?

Thanks.


Solution

  • I never got this working to my satisfaction with nginx. Depending on your specific needs, two solutions which may be adequate:

    • if you can tolerate the stream being on a different port, pass it through using the port forwarding feature of OpenWRT's built-in firewall.

    • use the reverse-proxy capabilities of tinyproxy. The default package has the reverse-proxy capabilities disabled by a flag, so you need to be comfortable checking out and building it yourself. This method is definitely more fiddly, but does also work.

    I'd still be interested to hear of anyone who gets this working with nginx.