frigate: Frigate clips do not play on remote devices in Home Assistant
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
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 31 (18 by maintainers)
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:
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…Hello, this is my output args config for my camera:
However my clips are still not playing on my Android device neither in the HA app nor in the browser.
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
Yeah, all of these are perfectly playable from Frigate UI.
Yep, that solves the issue. Now the clips for the camera that were not playable before are playable in the Chromecast. I simply added:
To the
<camera>.ffmpeg
. PS: there wasn’t anything before, and I don’t have a globaloutput_args
config.The clip now has a blank audio layer in AAC format.
Yes to both. Can cast any other media types (including live Frigate cameras) – just not Frigate clips.
Yep, it works nicely for me!
https://github.com/blakeblackshear/frigate/issues/2896#issuecomment-1058802957