Camera Stream recorder thread exception - Permission denied. Can't record to file anymore

Hi! I recently updated to Home Assistant 2021.1.5 and I’ve started having issues with recording a camera stream to file.

  • Home Assistant version: 2021.1.5
  • Frontend version: 20201229.1
  • I’m using Dietpi as OS which makes life easy for me when installing things (like HA).
  • I understand that HA is installed within a virtual environment - Python 3.8.6
  • Running on RPi 3 Model B+ (armv7l)

Unfortunately I do not know if this was broken in previous versions (of if it was something I did subsequently) as I had not used the feature recently, but below details the issue I have:

I have a few IP cameras streaming over RTSP. No major issue with streaming overall.
Below is a sample of my configuration.yaml

homeassistant:
  allowlist_external_dirs:
    - /path/to/Video/

stream:

ffmpeg:
  ffmpeg_bin: /usr/bin/ffmpeg

camera:
  - platform: ffmpeg
    name: Lounge
    input: rtsp://user:[email protected]:554
  - platform: ffmpeg
    name: Driveway
    input: rtsp://user:[email protected]:554/H.264

No issues with accessing snapshots or steams of these.

My issues is specifically with trying to record the stream to file.

service: camera.record
entity_id: camera.driveway
data:
  filename: >-
    /path/to/Video/Driveway.mp4
  duration: 30
  lookback: 5

I know for sure that the path itself is available because if I change the path to something that is not cleared I see a different error similar to “No access to path”.

It appears that there is some sort of permission error within the script? but I am a little out of my depth here. Any suggestions would be greatly appreciated!

Here is the log output:

Logger: root
Source: components/stream/recorder.py:61
First occurred: 11:35:54 AM (1 occurrences)
Last logged: 11:35:54 AM

Uncaught thread exception
Traceback (most recent call last):
  File "/home/homeassistant/.pyenv/versions/3.8.6/lib/python3.8/threading.py", line 932, in _bootstrap_inner
    self.run()
  File "/home/homeassistant/.pyenv/versions/3.8.6/lib/python3.8/threading.py", line 870, in run
    self._target(*self._args, **self._kwargs)
  File "/home/homeassistant/.pyenv/versions/3.8.6/lib/python3.8/site-packages/homeassistant/components/stream/recorder.py", line 61, in recorder_save_worker
    output.mux(packet)
  File "av/container/output.pyx", line 204, in av.container.output.OutputContainer.mux
  File "av/container/output.pyx", line 210, in av.container.output.OutputContainer.mux_one
  File "av/container/output.pyx", line 169, in av.container.output.OutputContainer.start_encoding
  File "av/error.pyx", line 336, in av.error.err_check
av.error.PermissionError: [Errno 13] Permission denied

Has anyone had a similar issue or is there something glaring that I should look into?