dermotduffy / frigate-hass-card

A Lovelace card for Frigate in Home Assistant
MIT License
551 stars 59 forks source link

go2rtc stream is a bit choppy on the card (audio ist smooth) #1659

Closed akcasoy closed 1 hour ago

akcasoy commented 3 hours ago

[REQUIRED] Card diagnostic information:

{
  "ha_version": "2024.10.1",
  "card_version": "5.2.0",
  "browser": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.5 Safari/605.1.15",
  "date": "2024-10-23T08:40:20.323Z",
  "frigate_version": {
    "01JAW7F0SF7AAWAFYP4K7Z7Z80": "5.4.0/0.14.1-f4f3cfa"
  },
  "lang": "de",
  "timezone": "Europe/Berlin",
  "git": {
    "build_version": "5.2.0-HEAD+g69249b6",
    "build_date": "Fri, 23 Jun 2023 15:26:26 GMT",
    "commit_date": "Thu, 22 Jun 2023 09:21:26 -0600"
  },
  "config": {
    "type": "custom:frigate-card",
    "cameras": [
      {
        "camera_entity": "camera.doorbell",
        "live_provider": "go2rtc",
        "go2rtc": {
          "stream": "reolink_doorbell"
        }
      }
    ]
  }
}

[REQUIRED] Description of problem:

I have also installed the v6 of the card, i have the same problem. With my above card configuration i have a choppy video stream (you can see from the timestamps on the footage), but audio is smooth. When i remove the "live_provider" and "go2rtc" attributes from the camera, i get a smooth video but without audio obviously (both videos are attached down).

My Frigate works really well all alone, and i do not have any problem with it. Here is some relevant parts of Frigate config:

audio:
  enabled: true

ffmpeg:
  hwaccel_args: preset-vaapi
  output_args:
    record: preset-record-generic-audio-aac

detectors:
  coral:
    type: edgetpu
    device: usb

go2rtc:
  streams:
    reolink_doorbell:
      - ffmpeg:http://192.168.178.114/flv?port=1935&app=bcs&stream=channel0_main.bcs&user=admin&password=password#video=copy#audio=copy#audio=opus
      - rtsp://admin:password@192.168.178.114/Preview_01_sub
    reolink_doorbell_sub:
      - ffmpeg:http://192.168.178.114/flv?port=1935&app=bcs&stream=channel0_ext.bcs&user=admin&password=password

cameras:
  doorbell:
    ffmpeg:
      inputs:
        - path: rtsp://127.0.0.1:8554/reolink_doorbell
          input_args: preset-rtsp-restream
          roles:
            - record
        - path: rtsp://127.0.0.1:8554/reolink_doorbell_sub
          input_args: preset-rtsp-restream
          roles:
            - audio
            - detect
    review:
      alerts:
        required_zones: vorgarten
      detections:
        required_zones: vorgarten
    zones:
      vorgarten:
        coordinates: 
         0.603,0.255,0.61,0.355,0.613,0.436,0.615,0.517,0.614,0.59,0.611,0.729,0.612,0.744,0.567,0.753,0.504,0.763,0.42,0.774,0.318,0.778,0.19,0.771,0.097,0.752,0.065,0.658,0.058,0.507,0.063,0.351,0.077,0.265,0,0.266,0,1,1,1,1,0
        loitering_time: 0
    live:
      stream_name: reolink_doorbell
version: 0.14

[OPTIONAL] Javascript errors shown in the web inspector:

As you can see from the "choppy" video at the time of timestamp 10:27:53, the card disappears and appears quickly again (Don't if this has sth. to do with my actual problem). At that time i get exactly 1 Console error in browser:

WebSocket connection to 'ws://192.168.178.5:8123/api/frigate/frigate/mse/api/ws?src=reolink_doorbell&authSig=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJjMjZhODM4ZjI3Yzk0OGI2YTcwNmE2M2YwMGM1ODk2OSIsInBhdGgiOiIvYXBpL2ZyaWdhdGUvZnJpZ2F0ZS9tc2UvYXBpL3dzIiwicGFyYW1zIjpbWyJzcmMiLCJyZW9saW5rX2Rvb3JiZWxsIl1dLCJpYXQiOjE3Mjk2NzI5MTcsImV4cCI6MTcyOTc1OTMxN30.GC8yKWmZT1pGxNf2R1LMNLoFnTQaSF32K1Uj7m-1xHs' failed: The operation couldn’t be completed. Socket is not connected

Choppy video with go2rtc (with smaller timestamp on the video):

https://github.com/user-attachments/assets/51aa8e9c-8ba1-45cb-a682-85f25c3c1618

Smooth video without go2rtc (with bigger timestamp on the video):

https://github.com/user-attachments/assets/6b258f62-423e-438c-beee-50c51b20b93f

akcasoy commented 3 hours ago

I have now tried different go2rtc modes and added:

modes:
   - mse

it now seems to be smoother on my Fire HD Tablet... but not on my iPhone (acording to AlexxIT/go2rtc iPhones do not support mse) 🫤