mrlt8 / docker-wyze-bridge

WebRTC/RTSP/RTMP/LL-HLS bridge for Wyze cams in a docker container
GNU Affero General Public License v3.0
2.69k stars 171 forks source link

FR: Delete Interval Snapshots Automatically #1330

Closed akeslo closed 3 months ago

akeslo commented 3 months ago

Describe the bug

What is the current behavior of interval snapshots? It looks like the snapshots will continue to write until the directory is out of space. Does it overwrite older snapshots when this happens? Is it possible to limit snapshots to the last 7 days, last 30 days or w.e?

My docker host ran out of space and all images went down as a result.

Thanks!

Affected Bridge Version

Latest

Bridge type

Docker Run/Compose

Affected Camera(s)

No response

Affected Camera Firmware

No response

docker-compose or config (if applicable)

No response

mrlt8 commented 3 months ago

The default behavior of the snapshots is to just overwrite the existing snapshot. Can you post any relevant parts of your docker-compose.yml?

akeslo commented 3 months ago

The default behavior of the snapshots is to just overwrite the existing snapshot. Can you post any relevant parts of your docker-compose.yml?

Absolutely, docker-compose.yml below:

version: '2.4'
services:
  wyze-bridge:
    container_name: wyze-bridge
    restart: unless-stopped
    image: mrlt8/wyze-bridge:dev
    ports:
      - 1935:1935   # RTMP
      - 8554:8554   # RTSP
      - 8888:8888   # HLS
      - 8889:8889   # WebRTC
      - 8189:8189/udp  # WebRTC/ICE
      - 5000:5000   # WEB-UI
    volumes:
      - type: bind
        source: /DATA/AppData/wyzebridge/snapshots
        target: /img
    environment:
      - WB_IP=192.168.3.101
      - ENABLE_AUDIO=True
      - QUALITY_BACK_LEFT_FLOOD_LIGHT=SD60
      - QUALITY_BACK_RIGHT_FLOOD_LIGHT=SD60
      - QUALITY_FRONT_LEFT_FLOOD_LIGHT=SD60
      - QUALITY_FRONT_RIGHT_FLOOD_LIGHT=SD60
      - ROTATE_CAM_KESCAM=1
      - SNAPSHOT=RTSP
      - SNAPSHOT_FORMAT={cam_name}/%Y-%m-%d/%H-%M-%S.jpg
    logging:
      driver: json-file
      options:
       max-size: "10m"
mrlt8 commented 3 months ago

Thanks, I made some changes in the dev branch, so you should be able to use SNAPSHOT_KEEP. Here are some examples:

# Keep snapshots for 3 minutes:
- SNAPSHOT_KEEP=180
- SNAPSHOT_KEEP=180s
- SNAPSHOT_KEEP=3m

# keep snapshots for 3 days:
- SNAPSHOT_KEEP=72h
- SNAPSHOT_KEEP=3d

# keep snapshots for 2 weeks:
- SNAPSHOT_KEEP=14d
- SNAPSHOT_KEEP=2w
akeslo commented 3 months ago

@mrlt8 thanks so much! Just gave it a try and looks to be working as expected!