Remove Video Records

There are two methods of video archive cleanup available in the system:

  1. Regular cleanup

  2. Manual cleanup via a console command

In this section:

Regular Video Cleanup

To configure the regular video cleanup, do the following:

  1. Open the /opt/findface-multi/configs/findface-multi-legacy/findface-multi-legacy.py configuration file.

    sudo vi /opt/findface-multi/configs/findface-multi-legacy/findface-multi-legacy.py
    
  2. Find the SERVICES section and set "vms_cleanup": True.

    SERVICES = {
        "ffsecurity": {
            ...
            "vms_cleanup": True,
        }
    }
    
  3. Find the VMS_CLEANUP_SETTINGS section and configure what video to remove, using the following parameters:

    • 'CLEANUP_BETWEEN_TRACKS': set True to remove video intervals that do not contain recognition events

    • 'CLEANUP_ARCHIVE': set True to remove the entire video archive older than a given number of days

    • 'ARCHIVE_CLEANUP_AGE': the maximum age of video archive in the system, days. Applicable if 'CLEANUP_ARCHIVE': True

    • 'CLEANUP_EVENTS_TYPES': event types that will be kept in the video archive, in the form of a dictionary, e.g., [‘face’, ‘body’, ‘car’]

    • 'KEEP_EVENT_BEFORE_AFTER': interval before and after a track with events, that won’t be removed in order to preserve meaningful information related to them, seconds. The value must be less than CLEANUP_THRESHOLD

    • 'CLEANUP_THRESHOLD': minimum interval between tracks with events, seconds. If the interval between tracks is shorter, it won’t be removed

      Tip

      See the RRULE calculator here.

    'VMS_CLEANUP_SETTINGS': {
        'CLEANUP_BETWEEN_TRACKS': True,
        'CLEANUP_ARCHIVE': True,
        'ARCHIVE_CLEANUP_AGE': 9,
        'CLEANUP_EVENTS_TYPES': ['car'],
        # Add `safe_time_interval` in seconds to each `track` subject to delete
        # Prevents deletion of essential data.
        # Should be lower than CLEANUP_THRESHOLD
        'KEEP_EVENT_BEFORE_AFTER': 10,  # minimal allowed value
        # Threshold between `intervals` in seconds.
        # If duration between `tracks` < `CLEANUP_THRESHOLD`
        # interval between tracks will not be added to deletion tasks
        'CLEANUP_THRESHOLD': 360,  # minimal allowed value
    },
    
  4. Find the 'VMS_CLEANUP_SERVICE_SCHEDULE' parameter and specify a recurrence rule (RRULE) for scheduling video cleanup.

    Tip

    See the RRULE calculator here.

    # rrule (recurrence rule) for scheduling `vms_cleanup` service
    'VMS_CLEANUP_SERVICE_SCHEDULE': 'RRULE:FREQ=HOURLY;INTERVAL=3;WKST=MO',
    
  5. Restart the findface-multi-findface-multi-legacy-1 container.

    sudo docker container restart findface-multi-findface-multi-legacy-1
    

Manual Video Cleanup

You can manually remove video chunks older than the given number of days by executing the command below. To set the number of days, use the –vms-videos-max-age argument.

sudo docker exec -it findface-multi-findface-multi-legacy-1 /opt/findface-security/bin/python3 /tigre_prototype/manage.py cleanup_vms --vms-videos-max-age=30