3

OpenWRT で nginx を使用して、IP カメラからのモーション jpeg フィードをリバース プロキシしていますが、フレーム サイズとレートが非常に低い場合でも、最大 10 ~ 15 秒の遅延が発生します。OpenWRT デバイスをパスから削除すると、カメラにまったく遅延なくアクセスできます。

遅延の長さ (および時間の経過とともに大きくなるという事実) のため、これはある種のバッファリング/キャッシュの問題のように見えます。を設定proxy_buffering offしましたが、他に気をつけることはありますか?

ありがとう。

4

3 に答える 3

4

Arduino Yun に mjpg-streamer をインストールし、ルーターの設定で、Web サーバーのみにホワイトリストに登録されたポート転送をセットアップしました。

これは、サイト対応ディレクトリにある私の Nginx 構成です。

server {
  listen      80;
  server_name cam.example.com;
  error_log /var/log/nginx/error.cam.log;
  access_log /var/log/nginx/access.cam.log;

  location    / {
    set $pp_d http://99.99.99.99:9999/stream_simple.html;
    if ( $args = 'action=stream' ) {
      set $pp_d http://99.99.99.99:9999/$is_args$args;
    }
    if ( $args = 'action=snapshot' ) {
      set $pp_d http://99.99.99.99:9999/$is_args$args;
    }

    proxy_pass $pp_d;
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";
    proxy_set_header Host $host:$server_port;
    proxy_set_header X-Forwarded-Proto $scheme;
    proxy_set_header X-Forwarded-For $remote_addr;
    proxy_set_header X-Forwarded-Port $server_port;
    proxy_set_header X-Request-Start $msec;
  }
}
于 2014-07-20T00:25:03.697 に答える
0

I have Nginx on Openwrt BB (wndr3800) reverse-proxying to a dlink 932LB1 ip cam, and it's working nicely. No significant lag, even before I disabled proxy_buffering. If I have a lot of stuff going over the network, the video can get choppy, but no more than it does with a straight-to-camera link from the browser (or from any of my ip cam apps). So... it is possible.

Nginx was the way to go for me. I tried tinyproxy & lighttpd for the reverse proxying, but each has missing features on OpenWrt. Both tinyproxy and lighttpd require custom compilation for the full reverse proxy features, and (AFAIK) lighttpd will not accept FQDNs in the proxy directive.

Here's what I have going:

  • Basic or digest auth on public facing Nginx provides site-wide access control.
  • I proxy my CGI scripts (shell, haserl, etc) to Openwrt's uhttpd.
  • Tightly controlled reverse-proxy to the camera mjpeg & jpeg API, no other camera functions are exposed to the public.
  • Camera basic-auth handled by Nginx (proxy_set_header), so no backend authorization code exposed to public.
  • Relatively small footprint (no perl, apache, ruby, etc).

I would include my nginx.conf here, except there's nothing unusual about it... just the bare bones proxy stuff. You might try tcpdump or wireshark to see what's cluttering your LAN, if traffic is indeed your culprit.

But it sounds like something about your router is the cause of the delay. Maybe the hardware just can't handle the cpu/traffic load, or there could be something else on your Openwrt setup that is hogging the highway. Is your video smooth and just delayed? Or are you seeing seriously choppy video? The lengthening delay you mention does sound like a buffer/cache thing... but I don't know what would be doing that.

于 2015-06-03T05:19:46.930 に答える
0

nginxでこれが満足に機能することはありませんでした。特定のニーズに応じて、適切な 2 つのソリューション:

  • ストリームが別のポートにあることを許容できる場合は、OpenWRT の組み込みファイアウォールのポート転送機能を使用してストリームを通過させます。

  • tinyproxy のリバース プロキシ機能を使用します。デフォルトのパッケージにはフラグによってリバース プロキシ機能が無効になっているため、自分でチェックアウトしてビルドすることに慣れている必要があります。この方法は確かに面倒ですが、うまくいきます。

これをnginxで動作させる人の話を聞いてみたいと思います.

于 2011-11-02T14:17:25.173 に答える