Frigate question. Can I delete files in /media/frigate/clips

Can I delete safely and at random files in /media/frigate/clips?

Here’s my problem. That folder is now 6Gb. (/media/frigate is 17.6Gb). I don’t need nor want all of that in a system/backup.

I see a frigate.db, so there seems to be a database, so would deleting a file break that database?

I’ve changed my config to retain one day:

    record:
      enabled: True
      events:
        pre_capture: 5
        post_capture: 5
        retain:             #Keep for one day
          default: 1

But there are files from last month still present.

What if I delete the integration and files, then reinstall Frigate?

1 Like

You only changed the recording retention not the snapshots retention (which is what is inside of /clips/). In general you should not delete files manually as you can just delete via the webUI.

Why don’t you use partial backup and exclude the media folder?

Because I can’t do it in an automation.

1 Like

I’ve added this to my camera profiles:

    #Frigate saves snapshot images in /media/frigate/clips
    snapshots:
      enabled: True
      timestamp: false
      bounding_box: true
      retain:
        default: 2 #days

ONE
AT
A
TIME

Hardly an optimal solution. Do you have any idea how many clips are in a 17GB folder? How difficult would it be to implement a “Delete All” button?

Since my database seems to be screwed up1, couldn’t I just delete the add-on and all the files then start over?

(1) I can’t do a full backup because the backup python script errors on missing JPG files in ‘clips’. (Why does the backup operation care?)

1 Like

1 Like

Deleting the addon does nothing, all you need to do is stop the addon, delete the files in /frigate/media and then start the addon again if you want.

This has nothing to do with frigate’s DB. The HA backup konws nothing about Frigate’s DB so that error is something that needs to be addressed separately.

Now, make it exclude the media folder.

To exclude a folder, I have to list all of the folders except the media folder. However when I do a partial backup even with a single add-on slug, or a single folder, it runs and no backup is created. I can’t find anything in the logs that says why it failed.

You mean /media/frigate
Did this and now I can again make a full backup without errors.
It’s a mystery why backup should fail because it can’t find a JPG file in /media/frigate…

service: hassio.backup_partial
data:
  compressed: true
  homeassistant: true
  name: Backup Parcial {{now().strftime("%D - %T")}}
  location: /backup
  addons:
    - a0d7b954_adguard
    - a0d7b954_ssh
    - 2ad4c73a_argon_one_temp_linear
    - 9074a9fa_cloudflared
    - 1e14b3fb_cups
    - 5c53de3b_esphome
    - 5c53de3b_esphome-dev
    - a0d7b954_ftp
    - 2ad4c73a_hassosi2cconfiguratoraddon
    - 2ad4c73a_hassos_ssh_configurator_addon
    - core_mosquitto
    - a0d7b954_nodered
    - core_samba
    - a0d7b954_vscode
    - 45df7312_zigbee2mqtt
  folders:
    - ssl

Did you look in the supervisor’s logs?
Try a program like WinSCP to check if there isn’t a corrupted file in the backup folder that is not being shown in HA.

I had the same issue. Frigate really needs a “Delete All” button. Here’s my work-around… I duplicated my frigate.yml, renamed the dupe “frigate_running_backup.yml”, created another dupe and called it “frigate_cleanup.yml” Then I edited the cleanup yml to retain all clips, recordings, etc. for the shortest duration possible. I replaced the frigate.yml with the cleanup version, stopped and then restarted Frigate so that it would delete most things. This helped to delete most of the recordings. Then I ran a full backup, replaced the frigate.yml “cleanup” version with the copy of the original settings and was back in business. A bit of a PITA. Here’s hoping a Delete All button is forthcoming.

1 Like

There’s no reason for any of this if you are trying to have a fresh start, you can just delete /media/frigate to start over.

1 Like

This worked.

I just deleted the Frigate folder and when I restarted the add-on, it created a new folder.

How do you ‘just delete’ that folder? I am unable to find out where to even find the folder other than in the media tab, but that doesn’t have any additional options past just opening the folder. Apologies if this is a very simple operation

using ssh or some other tool available in HA OS via addons

Use the Samba Share add-on:

This addon exposes the following directories over smb (samba):

|Directory|Description|
| --- | --- |
|`addons`|This is for your local add-ons.|
|`backup`|This is for your backups.|
|`config`|This is for your Home Assistant configuration.|
|`media`|This is for local media files.|
|`share`|This is for your data that is shared between add-ons and Home Assistant.|
|`ssl`|This is for your SSL certificates.|
1 Like

Might I ask how do you delete via web UI? I could not find the delete button…

the red trash can to the right of the event