Help with camera.record

Once again I am trying to figure out the camera.record action.

I am running this action via developers tools:

action: camera.record
target:
  entity_id: camera.entrada
data:
  duration: 3
  lookback: 3
  filename: /config/www/snapshots/LastEntradaVideo2.mp4

When I run it, about 7 seconds go by then I get the green check mark. Since recording about 6 seconds of video the lag makes sense.

I then go the /www/snapshot folder and I do see the LastEntradaVideo2.mp4 file created. However when I click on the file a text file opens up that reads:

'utf-8' codec can't decode byte 0xe9 in position 39: invalid continuation byte

I did take a look at the official HA camera documentation at Camera - Home Assistant

It mentions: “Action record Make a .mp4 recording from a camera stream. Requires stream integration to be set up.”

I am no sure if I have the stream integration setup, how can I check?

I do use Frigate as my DVR. I used the Frigate HACS integration in HA. I am able to view the live streams for my 4 cameras. In addition if I go to my media folders I can see the different recordings, snapshots, etc., That said not sure if the Frigate integration also set up the stream integration, or if that is something I have to setup myself.

I do have an automation setup to take a snapshot and send it via whatsapp, and that is working without any issues.

As I continue to do some more testing I found something new. As I mentioned I have 4 cameras set up in frigate. Two of them have the Go2rtc enabled in Frigate while the other two don’t.

The tests I had ran was with those two cameras. I was able to run the action, get the green check mark and then end up with the file created that shows an error.

I now tried to do the same thing with one of the other two cameras and I get this error when I try run the action:

Failed to perform the action camera.record. camera.entrada_patio does not support record service

Like I mentioned, two cameras were not set up with Go2rtc on Frigate. I added all 4 of them to go2rtc. However when I would try to load the webrtc feeds on Frigate they wouldn’t load.

After a quick google search I learned I had to add the following to my Frigate configuration on the frigate server.

  webrtc:
    candidates:
      - 10.69.69.72:8555
      - stun:8555

I added it, restarted, and now my 4 cameras load with the webrtc stream. In home assistant when I view the live cams I can see it is picking up the webrtc because I see the mute grayed out, but with the jsmpeg stream no mute grayed out icon shows up.

Now on developers tools I can choose any of the 4 cameras to record from, with all of them I get the green check mark, and all of them create a new file on the folder as expected, but the file is just an error message.

I am starting to run out of ideas of what I could try.

I am now totally out of ideas of what else I could try. I went ahead and created a new generic camera using one of the cameras RTSP feeds. When I try to make a recording it creates the file, but the file doesn’t work. When I take a snapshot using this new generic camera I do get the snapshot as expected.

Seems now I am at the mercy of you wonderful helpful people that know much more than me about HA.

OMG turns out I am an idiot! I kept clicking on the file expecting for a video player to pop up and show the video, similar to what it does when you click on a jpg file which opens on a new window.

Out of curiosity I decided to download the file and realized it has been working properly all along!!