blakeblackshear / frigate

NVR with realtime local object detection for IP cameras
https://frigate.video
MIT License
18.76k stars 1.7k forks source link

[Support]: Live view and birdeyes don't work from external internet connection #8316

Closed alexchini closed 12 months ago

alexchini commented 12 months ago

Describe the problem you are having

Hi, I'm trying to expose the Frigate UI to the internet, using the method described here: https://docs.frigate.video/guides/reverse_proxyhttps://docs.frigate.video/guides/reverse_proxy

I can connect to the UI from the external address, manage events, watch snapshot and clips. In the camera debug i can see video but in the live view and birdeyes all the camera are blank.

The server have no firewall active, having only one public IP address and since I am using port 443 for another service my Apache configuration is as follows:

<VirtualHost *:80>

    AuthType Basic
    AuthName "Restricted Content"
    AuthUserFile /etc/apache2/.htpasswd
    Require valid-user
</Location>

ServerName alexchini.duckdns.org

ProxyPreserveHost On
ProxyPass "/"  "http://zoneminder.local:5000/"
ProxyPassReverse "/"  "http://zoneminder.local:5000/"

ProxyPass /ws ws://zoneminder.local:5000/ws
ProxyPassReverse /ws ws://zoneminder.local:5000/ws

ProxyPass /live/ ws://frigatepi.local:5000/live/
ProxyPassReverse /live/ ws://zoneminder.local:5000/live/

RewriteEngine on
RewriteCond %{HTTP:Upgrade} =websocket [NC]
RewriteRule /(.*)  ws://zoneminder.local:5000/$1 [P,L]
RewriteCond %{HTTP:Upgrade} !=websocket [NC]
RewriteRule /(.*)  http://zoneminder.local:5000/$1 [P,L]

From local address all is working fine

Version

0.12.1-367d724

Frigate config file

detectors:
  ov:
    type: openvino
    device: AUTO
    model:
      path: /openvino-model/ssdlite_mobilenet_v2.xml

model:
  width: 300
  height: 300
  input_tensor: nhwc
  input_pixel_format: bgr
  labelmap_path: /openvino-model/coco_91cl_bkgr.txt

# Include all cameras by default in Birdseye view
birdseye:
  enabled: True
  mode: continuous

go2rtc:
  streams:
    ipcam1:
      - rtsp://admin:{FRIGATE_RTSP_PASSWORD}@192.168.0.111:88/videoMain
    ipcam2:
      - rtsp://admin:@192.168.0.112:554/videoMain
    ipcam3:
      - rtsp://admin:{FRIGATE_RTSP_PASSWORD}@192.168.0.113:554/videoMain
    ipcam4:
      - rtsp://admin:{FRIGATE_RTSP_PASSWORD}@192.168.0.114:554/videoMain
    ipcam5:
      - rtsp://admin:@192.168.0.115:554/videoMain
    ipcam6:
      - rtsp://admin:@192.168.0.116:554/videoMain        

ffmpeg:
  hwaccel_args: preset-vaapi

mqtt:
  host: 192.168.0.188
  user: alemqtt
  password: cleppa6774

snapshots:
  # Optional: Enable writing jpg snapshot to /media/frigate/clips (default: shown below)
  enabled: True

cameras:
  ipcam1:
    ffmpeg:
      inputs:
        - path: rtsp://admin:{FRIGATE_RTSP_PASSWORD}@192.168.0.111:88/videoMain
          roles:
            - detect
    detect:
      width: 1280
      height: 720
    objects:
      track:
        - person
        - car
        - cat  
    record:
      enabled: True
      retain:
        days: 7
      events:
        retain:
          default: 14
          mode: active_objects
    mqtt:
          # Optional: Enable publishing snapshot via mqtt for camera (default: shown below)
          # NOTE: Only applies to publishing image data to MQTT via 'frigate/<camera_name>/<object_name>/snapshot'.
          # All other messages will still be published.
          enabled: True
          # Optional: print a timestamp on the snapshots (default: shown below)
          timestamp: True
          # Optional: draw bounding box on the snapshots (default: shown below)
          bounding_box: True
          # Optional: crop the snapshot (default: shown below)
          crop: True
          # Optional: height to resize the snapshot to (default: shown below)
          height: 270
          # Optional: jpeg encode quality (default: shown below)
          quality: 70
    # live:
    #   stream_name: ipcam1                  

  ipcam2:
    ffmpeg:
      inputs:
        - path: rtsp://admin:@192.168.0.112:554/videoMain
          roles:
            - detect
    detect:
      width: 1280
      height: 720
    objects:
      track:
        - person
        - cat  
    record:
      enabled: True
      retain:
        days: 7
      events:
        retain:
          default: 14
          mode: active_objects

  ipcam3:
    ffmpeg:
      inputs:
        - path: rtsp://admin:{FRIGATE_RTSP_PASSWORD}@192.168.0.113:554/videoMain
          roles:
            - detect
    detect:
      width: 1280
      height: 720
    objects:
      track:
        - person
        - cat  
    record:
      enabled: True
      retain:
        days: 7
      events:
        retain:
          default: 14
          mode: active_objects 
  ipcam4:
    ffmpeg:
      inputs:
        - path: rtsp://admin:{FRIGATE_RTSP_PASSWORD}@192.168.0.114:554/videoMain
          roles:
            - detect
    detect:
      width: 1280
      height: 720
    objects:
      track:
        - person
        - cat  
    record:
      enabled: True
      retain:
        days: 7
      events:
        retain:
          default: 14
          mode: active_objects                         
  ipcam5:
    ffmpeg:
      inputs:
        - path: rtsp://admin:@192.168.0.115:554/videoMain
          roles:
            - detect
    detect:
      width: 1280
      height: 720
    objects:
      track:
        - person
        - cat  
    record:
      enabled: True
      retain:
        days: 7
      events:
        retain:
          default: 14
          mode: active_objects
  ipcam6:
    ffmpeg:
      inputs:
        - path: rtsp://admin:@192.168.0.116:554/videoMain
          roles:
            - detect
    detect:
      width: 1280
      height: 720
    objects:
      track:
        - person
        - cat  
    record:
      enabled: True
      retain:
        days: 7
      events:
        retain:
          default: 14
          mode: active_objects

Relevant log output

2023-10-25 15:45:06.368536656  [INFO] Starting Frigate...
2023-10-25 15:45:07.884834689  [2023-10-25 15:45:07] frigate.app                    INFO    : Starting Frigate (0.12.1-367d724)
2023-10-25 15:45:07.929283605  [2023-10-25 15:45:07] frigate.config                 WARNING : Customizing more than a detector model path is unsupported.
2023-10-25 15:45:07.939522306  [2023-10-25 15:45:07] peewee_migrate                 INFO    : Starting migrations
2023-10-25 15:45:07.944088486  [2023-10-25 15:45:07] peewee_migrate                 INFO    : There is nothing to migrate
2023-10-25 15:45:07.966013346  [2023-10-25 15:45:07] detector.ov                    INFO    : Starting detection process: 288
2023-10-25 15:45:07.969534083  [2023-10-25 15:45:07] frigate.app                    INFO    : Output process started: 290
2023-10-25 15:45:07.980386158  [2023-10-25 15:45:07] frigate.app                    INFO    : Camera processor started for ipcam1: 293
2023-10-25 15:45:07.982626495  [2023-10-25 15:45:07] frigate.app                    INFO    : Camera processor started for ipcam2: 295
2023-10-25 15:45:07.993621681  [2023-10-25 15:45:07] frigate.app                    INFO    : Camera processor started for ipcam3: 296
2023-10-25 15:45:08.000989900  [2023-10-25 15:45:07] frigate.app                    INFO    : Camera processor started for ipcam4: 298
2023-10-25 15:45:08.007654047  [2023-10-25 15:45:08] frigate.app                    INFO    : Camera processor started for ipcam5: 299
2023-10-25 15:45:08.014503262  [2023-10-25 15:45:08] frigate.app                    INFO    : Camera processor started for ipcam6: 301
2023-10-25 15:45:08.026538565  [2023-10-25 15:45:08] frigate.app                    INFO    : Capture process started for ipcam1: 302
2023-10-25 15:45:08.033369399  [2023-10-25 15:45:08] frigate.app                    INFO    : Capture process started for ipcam2: 303
2023-10-25 15:45:08.040668600  [2023-10-25 15:45:08] frigate.app                    INFO    : Capture process started for ipcam3: 305
2023-10-25 15:45:08.051124951  [2023-10-25 15:45:08] frigate.app                    INFO    : Capture process started for ipcam4: 312
2023-10-25 15:45:08.062122728  [2023-10-25 15:45:08] frigate.app                    INFO    : Capture process started for ipcam5: 319
2023-10-25 15:45:08.071708973  [2023-10-25 15:45:08] frigate.app                    INFO    : Capture process started for ipcam6: 322
2023-10-25 15:45:08.404498338  [2023-10-25 15:45:08] frigate.detectors.plugins.openvino INFO    : Model Input Shape: {1, 300, 300, 3}
2023-10-25 15:45:08.404677520  [2023-10-25 15:45:08] frigate.detectors.plugins.openvino INFO    : Model Output-0 Shape: {1, 1, 100, 7}
2023-10-25 15:45:08.404762530  [2023-10-25 15:45:08] frigate.detectors.plugins.openvino INFO    : Model has 1 Output Tensors

FFprobe output from your camera

ffprobe version 4.2.7-0ubuntu0.1 Copyright (c) 2007-2022 the FFmpeg developers
  built with gcc 9 (Ubuntu 9.4.0-1ubuntu1~20.04.1)
  configuration: --prefix=/usr --extra-version=0ubuntu0.1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-nvenc --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
  libavutil      56. 31.100 / 56. 31.100
  libavcodec     58. 54.100 / 58. 54.100
  libavformat    58. 29.100 / 58. 29.100
  libavdevice    58.  8.100 / 58.  8.100
  libavfilter     7. 57.100 /  7. 57.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  5.100 /  5.  5.100
  libswresample   3.  5.100 /  3.  5.100
  libpostproc    55.  5.100 / 55.  5.100
Input #0, rtsp, from 'rtsp://admin:@192.168.0.115:554/videoMain':
  Metadata:
    title           : h264.mp4
    comment         : TAS-Tech Live Cast
  Duration: N/A, start: 0.535800, bitrate: N/A
    Stream #0:0: Video: h264 (Main), yuv420p(progressive), 1280x720, 11.92 fps, 50 tbr, 90k tbn, 23.75 tbc

Frigate stats

No response

Operating system

Debian

Install method

Docker Compose

Coral version

M.2

Network connection

Mixed

Camera make and model

foxcam

Any other information that may be helpful

No response

NickM-27 commented 12 months ago

What are the browser logs? Most likely this is an issue where websockets are being blocked

Someone had a similar issue yesterday https://github.com/blakeblackshear/frigate/issues/8302

alexchini commented 12 months ago

yes thanks in the browser log i can see a websocket connection refused error, now i ve to find how configure the websocket .

alexchini commented 12 months ago

Ok i found the solution in my case, since I'm using a Docker installed on an Ubuntu server, all I needed to do was enable WebSockets on Apache with the command: a2enmod proxy_wstunnel

Maybe can be usefull for someone that have same problem.

All of this is done for have a secure access password protected for the frigate UI