blakeblackshear / frigate

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

[Support]: WebRTC feed fails to load #6371

Closed Coder84619 closed 1 year ago

Coder84619 commented 1 year ago

Describe the problem you are having

The webRTC feed in the Frigate console never loads. MSE and jsmpeg are almost instant. Frigate is a Docker container on an Ubuntu 22.04 VM, on Proxmox 7.4. I changed camera iframe interval from 4x FPS to 1x FPS and it didn't help. Going into the RTC console doesn't want to stream the feed either.

Version

0.12.0-DA3E197

Frigate config file

# ~/docker/frigate/config.yml

ui:
  use_experimental: false
  live_mode: mse

record:
  expire_interval: 10

ffmpeg:
  hwaccel_args: preset-vaapi 

detectors:
  coral:
    type: edgetpu
    device: pci

logger:
  default: info

rtmp:
  enabled: false

live:
  height: 720
  quality: 1

birdseye:
  enabled: True
  restream: false
  width: 1280
  height: 720
  quality: 1
  mode: continuous

go2rtc:
  streams:
    garage:
      - rtsp://:554/cam/realmonitor?channel=1&subtype=0
    garage_sub:
      - rtsp://:554/cam/realmonitor?channel=1&subtype=2
    webrtc:
      candidates:
        - 10.13.2.213:8555
        - stun:8555

cameras:
  garage:
    ffmpeg:
      inputs:
        - path: rtsp://127.0.0.1:8554/garage_sub
          input_args: preset-rtsp-restream
          roles:
            - detect
        - path: rtsp://127.0.0.1:8554/garage
          input_args: preset-rtsp-restream
          roles:
            - record
    detect:                 
      width: 1280
      height: 720
      fps: 5
    objects:
      track:
        - person
        - car
      filters:
        person:
          min_score: 0.4
          threshold: 0.5
          min_area: 700
    snapshots:
      enabled: true
      timestamp: true
      bounding_box: true
      crop: True
      height: 500
      retain:
        default: 30
    record:
      enabled: True
      retain: 
        days: 45
        mode: motion
      events:
        retain:
          default: 5 
          mode: motion 
        pre_capture: 10
        post_capture: 30

Relevant log output

No errors in any GUI accessible logs.

FFprobe output from your camera

[{"return_code":0,"stderr":"","stdout":{"programs":[],"streams":[{"avg_frame_rate":"5/1","codec_long_name":"H.264/AVC/MPEG-4AVC/MPEG-4part10","height":720,"width":1280}]}},{"return_code":0,"stderr":"","stdout":{"programs":[],"streams":[{"avg_frame_rate":"15/1","codec_long_name":"H.264/AVC/MPEG-4AVC/MPEG-4part10","height":1520,"width":2688}]}}]

Frigate stats

No response

Operating system

Debian

Install method

Docker Compose

Coral version

M.2

Network connection

Wired

Camera make and model

IPC-T5442T-ZE

Any other information that may be helpful

No response

Coder84619 commented 1 year ago

{ "producers": null, "consumers": null }

NickM-27 commented 1 year ago

{ "producers": null, "consumers": null }

Yeah have to get this info while a stream is going

NickM-27 commented 1 year ago

In chrome you can use chrome://webrtc-internals and it should give some helpful information as to why it's failing.

NickM-27 commented 1 year ago

Also please include your docker compose

Coder84619 commented 1 year ago

If I'm just accessing video locally, does the stun external port need to be open? I ONLY want webrtc internal on my LAN with NO external access.

http://10.13.x.x:5000/cameras/garage, { iceServers: [stun:stun.l.google.com:19302], iceTransportPolicy: all, bundlePolicy: balanced, rtcpMuxPolicy: require, iceCandidatePoolSize: 0 }

ICE connection state: new => disconnected
Connection state: new => failed
Signaling state: new
ICE Candidate pair:  (not connected)

url: stun:stun.l.google.com:19302
address: [0:0:0:x:x:x:x:x]
port: 53271
host_candidate: [0:0:0:x:x:x:x:x]:53271
error_text: STUN binding request timed out.
error_code: 701

connectionstatechange
failed

~/docker/frigate/frigate-compose.yml

version: "3.9"
services:
  frigate:
    container_name: frigate
    privileged: true
    restart: unless-stopped
    image: ghcr.io/blakeblackshear/frigate:stable
    shm_size: "384mb" # update for your cameras based on calculation
    devices:
      - /dev/apex_0:/dev/apex_0 # passes a PCIe Coral
      - /dev/dri/renderD128:/dev/dri/renderD128
      - /dev/dri/card0:/dev/dri/card0
    volumes:
      - /etc/localtime:/etc/localtime:ro
      - /home/docker/frigate/config.yml:/config/config.yml
      - /media/frigate:/media/frigate
      - type: tmpfs # Optional: 1GB of memory, reduces SSD/SD Card wear
        target: /tmp/cache
        tmpfs:
          size: 1000000000
    ports:
      - "5000:5000"
      - "8554:8554" # RTSP feeds
      - "8555:8555/tcp" # WebRTC over tcp
      - "8555:8555/udp" # WebRTC over udp
    environment:
      FRIGATE_RTSP_PASSWORD: "rtsppassword"
NickM-27 commented 1 year ago

if you only want webrtc internally then I'd suggest not including the stun candidate in the candidates list

Coder84619 commented 1 year ago

Ok I removed it and restarted, but didn't help. Now in the webrtc internals there's no candidate grid, unlike when I had the stun port.

timestamp 5/4/2023, 7:13:18 AM
bytesSent 0
[bytesSent_in_bits/s] 0
packetsSent 0
[packetsSent/s] 0
bytesReceived 0
[bytesReceived_in_bits/s] 0
packetsReceived 0
[packetsReceived/s] 0
dtlsState new
localCertificateId CFB8:8A:F8:CC:30:B0:02:0E:03:CB:C9:7F:64:8F:C3:27:84:AB:FD:79:42:F5:C2:17:B0:7A:F8:3D:4E:18:F3:A5
dtlsRole server
selectedCandidatePairChanges 0
iceRole controlling
iceLocalUsernameFragment PQy0
iceState failed

Statistics IT01V1775984628

timestamp | 5/4/2023, 7:14:46 AM ssrc | 1775984628 kind | video transportId | T01 mediaType | video jitter | 0 packetsLost | 0 trackIdentifier | fad886f0-e546-433d-9333-0e3555fa0847 mid | 0

NickM-27 commented 1 year ago

So 10.13.2.213:8555 is the IP of your device running frigate correct? What is the IP of the device you are using to watch the stream?

Coder84619 commented 1 year ago

Yes. It's 10.13.2.107.

NickM-27 commented 1 year ago

Weird, might recommend creating an issue on go2rtc. I have no idea why it wouldn't be working

kirsch33 commented 1 year ago

@Coder84619 same issue and setup as you here. digging into it. follow up if you make any progress and ill do the same

SpartanTech commented 1 year ago

same issue as you here. if anyone of yall gets it solved, lemme know.

moved from HA OS VM to Docker VM using the same configs. Works in HA VM, does not work in Docker VM. EVerything works fine and performance is faster in docker VM but WebRTC just shows the loading circle forever with no errors,

connectionstatechange fails when using chrome's debug tool Have a feeling the issue is with docker compose's yml. there is nothing specific in regards what to broadcast on.

` version: "3.9" services: frigate: container_name: frigate privileged: true # this may not be necessary for all setups restart: unless-stopped image: ghcr.io/blakeblackshear/frigate:stable shm_size: "164mb" # update for your cameras based on calculation above devices:

SpartanTech commented 1 year ago

Solved it by editing the example given in the frigate docs and specifying network: host and removing ports. But this seems... not like the correct way.

How do I use it like the docs recommend in docker compose, but fix whatever subnet/ip it is using instead. Looks to be bridge?

NickM-27 commented 1 year ago

If you have devices across multiple subnets then I believe host is necessary. Host in general is going to be more compatible and work more easily

Coder84619 commented 1 year ago

If you have devices across multiple subnets then I believe host is necessary. Host in general is going to be more compatible and work more easily

I only have a single subnet.

github-actions[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Coder84619 commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Well it's still broken for me.

clearwave1 commented 1 year ago

I am having the same issue and I also have Frigate deployed in a Docker Compose setup on Proxmox.

@SpartanTech - can you please elaborate on what you changed to get it working (if this fixed it for you).

I have been running this setup for over a year but I just added the Reolink POE Doorbell and I'm trying to work through audio issues and saw that WebRTC was needed for 2-way audio.

github-actions[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Swedlund commented 1 year ago

I am also in the same boat.

I have copied the configuration for go2rtc from the website and changed the credentials for the Reolink camera that I use. WebRTC wont play, only mse and jsmpeg.

After a while when loading WebRTC stream I get the following message in "chrome://webrtc-internals/": connectionstatechange failed

lieblinger commented 11 months ago

Same for me. @Swedlund Were you able to resolve this?

Swedlund commented 11 months ago

Hi @lieblinger, I'm not entirely sure what made it work for me. But something I had changed before it started working was to update go2rtc to a later version. I am now running 1.8.1. You can check which version of go2rtc you have under Frigate webgui -> System. If you have an old version, you can either download the latest go2rtc and tell the frigate container to use it or simply use frigate 0.13.0 which contains a newer version.

lieblinger commented 11 months ago

Then it's probably because I'm on version 1.2.0. Waiting for the final 1.3.0 release and hope that it'll resolve this. Thanks for you help!

jprasm commented 8 months ago

I'm running frigate in an lxc on proxmox as well. I've got a nearly identical docker compose file as the one above....I'm 'stunning' the dang container and webrtc feeds don't work. MSE and JSMPEG are fine.

ammgws commented 7 months ago

Running Frigate via Docker in an unpriveleged LXC in Proxmox, default Proxmox firewall settings.

Had to add network_mode: "host" to docker-compose.yml (and remove the whole ports: section) - now WebRTC works, where as before it wouldn't load at all due to whatever networking issue was occurring..

jprasm commented 7 months ago

@ammgws Thank you for helping me solve a long standing issue. Got it working.

Mkcein commented 5 months ago

Running Frigate via Docker in an unpriveleged LXC in Proxmox, default Proxmox firewall settings.

Had to add network_mode: "host" to docker-compose.yml (and remove the whole ports: section) - now WebRTC works, where as before it wouldn't load at all due to whatever networking issue was occurring..

Thanks, your tip save me !!

GHJJ123 commented 4 months ago

Running Frigate via Docker in an unpriveleged LXC in Proxmox, default Proxmox firewall settings.

Had to add network_mode: "host" to docker-compose.yml (and remove the whole ports: section) - now WebRTC works, where as before it wouldn't load at all due to whatever networking issue was occurring..

omg, I've given up trying to get my webrtc feed to work, but gave it another try today... found this thread and viola.

Simple solution that fixed my issue, thank you!