question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Frigate clips do not play on remote devices in Home Assistant

See original GitHub issue

Describe the problem you are having

I started exploring implementation of https://github.com/dermotduffy/frigate-hass-card/issues/439 , and realized that I cannot get HA to play any Frigate clips on remote media players.

Steps to reproduce:

  • Open the HA media player (sidebar -> ‘Media’)
  • Choose ‘Frigate’
  • Choose ‘Clips’
  • In the bottom right use the device selector to choose any device other than ‘Browser’
  • Click play on any clip.

Expected behavior:

  • HA should play the media on the remote device.

Observed behavior:

  • The chromecast logo will appear on the target device, but the media will not play. The HA logs contain:
2022-05-01 16:23:44 ERROR (Thread-14) [homeassistant.components.cast.media_player] Failed to cast media https://[HA]/api/hls/0c7cf72cdcf07935f13b933daa682bc501338a1340553c29ff35ec389849766/master_
playlist.m3u8?authSig=[AUTH] from internal_url ([HA]). Please make sure the UR
L is: Reachable from the cast device and either a publicly resolvable hostname or an IP address

Initially I thought this was either an error on my end, or a problem with the integration. However:

  • Other media (e.g. random HA cameras) work just fine casting to the same devices from HA via the same steps above. It is Frigate event media only that will not play.
  • In chatting with @NickM-27 on discord, he observes the same – but found some clips for some cameras that do work, which make it less likely this is an integration issue vs a Frigate or video issue.

Related/similar old bug: https://github.com/blakeblackshear/frigate/issues/2400

Version

2.2.2/0.10.1-83481af

Frigate config file

mqtt:
  host: [MQTT]
ffmpeg:
  global_args:
    - -hide_banner
    - -loglevel
    - info
  hwaccel_args:
    - -hwaccel
    - vaapi
    - -hwaccel_device
    - /dev/dri/renderD128
    - -hwaccel_output_format
    - yuv420p
 
snapshots:
  enabled: True
cameras:
  [many more cameras elided]
  sitting_room:
    ffmpeg:
      inputs:
        - path: [PATH]
          roles:
            - detect
            - rtmp
            - record
    detect:
      enabled: True
      width: 1920
      height: 1080
      fps: 4
    record:
      enabled: True
      retain:
        days: 0
      events:
        retain:
          default: 1
    motion:
      mask:
        - 1868,1058,1868,1018,1392,1018,1392,1058
 
detectors:
  coral:
    type: edgetpu
    device: usb
objects:
  track:
    - person
    - car
  filters:
    person:
      # Optional: minimum score for the object to initiate tracking (default: shown below)
      min_score: 0.6
      # Optional: minimum decimal percentage for tracked object's computed score to be considered a true positive (default: shown below)
      threshold: 0.75

Relevant log output

Log output shown above.

FFprobe output from your camera

(~) $ ffprobe rtsp://[WYZE-CAMERA]
ffprobe version 4.2.4-1ubuntu0.1 Copyright (c) 2007-2020 the FFmpeg developers
  built with gcc 9 (Ubuntu 9.3.0-10ubuntu2)
  configuration: --prefix=/usr --extra-version=1ubuntu0.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 '[PATH]:
  Metadata:
    title           : Session streamed by the WYZE Media Server
    comment         : live
  Duration: N/A, start: 0.000625, bitrate: N/A
    Stream #0:0: Video: h264 (Main), yuv420p(progressive), 1920x1080, 15 fps, 15 tbr, 90k tbn, 30 tbc
    Stream #0:1: Audio: pcm_alaw, 8000 Hz, 1 channels, s16, 64 kb/s

Frigate stats

No response

Operating system

Other Linux

Install method

Docker Compose

Coral version

USB

Network connection

Wired

Camera make and model

Wyze cam v2

Any other information that may be helpful

No response

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:31 (18 by maintainers)

github_iconTop GitHub Comments

1reaction
nvvasilevcommented, May 26, 2022

Ok, got it working. I setup an rtsp-server and stream the USB cam live feed as an rtsp stream using this ffmpeg command: ffmpeg -f v4l2 -i /dev/video0 -vf "transpose=2,transpose=2" -f segment -segment_time 10 -segment_format mp4 -reset_timestamps 1 -strftime 1 -pix_fmt yuv420p -c:v libx264 -c:a aac -preset ultrafast -tune zerolatency -b:v 600k -s 1280x720 -f rtsp -rtsp_transport tcp rtsp://localhost:8554/frontdoor

Then I use the rtsp stream in the Frigate configuration like this:

cameras:
  frontdoor:
    ffmpeg:
      inputs:
        - path: rtsp://192.168.1.139:8554/frontdoor
          roles:
            - detect
            - record

And now every new clip recording with this new config is playable on my Android devices. I wonder if in the output args for the detect role from the previous config had to be configured with the -c:v libx264 -c:a aac in order to fix the problem as it was the only role not configured to use audio…

      output_args:
        rtmp: -vf transpose=2,transpose=2 -c:v libx264 -c:a aac -preset ultrafast -tune zerolatency -b:v 600k -f flv
        record: -vf transpose=2,transpose=2 -c:v libx264 -c:a aac -preset ultrafast -tune zerolatency -b:v 600k -f segment -segment_time 10 -segment_format mp4 -reset_timestamps 1 -strftime 1
        detect: -vf transpose=2,transpose=2 -f rawvideo -pix_fmt yuv420p
1reaction
NickM-27commented, May 2, 2022

Yeah, honestly not too worried about mine as it works mostly and could be some network unhappiness or something.

I’ll add a PR to add a section in the docs with a note that audio is required for using casting with the integration for others that desire the functionality

Read more comments on GitHub >

github_iconTop Results From Across the Web

Can't Play Frigate Clips - Home Assistant Community
I am only using snapshot and clips, I am not using frigate to record. I have tried playing from Android device and also...
Read more >
Home Assistant Integration - Frigate Docs
The best way to integrate with Home Assistant is to use the official integration. ... supports casting clips and camera streams to supported...
Read more >
Frigate Clips and Camera Viewing : r/homeassistant - Reddit
So I am wanting to avoid my cameras connecting to china so I have disconnected them from the internet and disabled the iOS...
Read more >
Frigate and Home Assistant - YouTube
An indepth look at how Frigate integrates into Home Assistant. Using the Frigate HACS integration we can look at our live video streams, ......
Read more >
Remote Frigate in Docker with Home Assistant Integration
Install Frigate in Docker on Bare Metal or VM and Integrate it with Home Assistant.Support this channel by becoming a ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found