80 lines
2.0 KiB
Markdown
80 lines
2.0 KiB
Markdown
# msv-webcam-backend
|
|
|
|
A lightweight FTPS-based backend that automatically watches camera upload folders, converts the latest image from each camera to AVIF format, and stores them in a `current/` directory for easy access (e.g., via Nginx).
|
|
|
|
---
|
|
|
|
## Features
|
|
- FTPS server for receiving image uploads
|
|
- Automatic detection of the newest image per camera folder
|
|
- Conversion to AVIF format using `avifenc`
|
|
- Persistent storage of converted images in a shared `current/` directory
|
|
- Designed for integration with a frontend or Nginx for live webcam feeds
|
|
|
|
---
|
|
|
|
## Getting Started
|
|
|
|
### 0) Import project files
|
|
Make sure the following files are present in your repository:
|
|
```
|
|
docker-compose.yml
|
|
Dockerfile
|
|
post_upload.sh
|
|
```
|
|
|
|
### 1) Configure user credentials
|
|
Edit `docker-compose.yml` and set your FTPS username and password:
|
|
```yaml
|
|
environment:
|
|
- BF_FTPS_VSFTPD_USER=username
|
|
- BF_FTPS_VSFTPD_PASS=userpw
|
|
```
|
|
|
|
### 2) Make the post-upload script executable
|
|
```bash
|
|
chmod +x post_upload.sh
|
|
```
|
|
|
|
### 3) Build the Docker image
|
|
```bash
|
|
docker-compose build
|
|
```
|
|
|
|
### 4) Start the service
|
|
```bash
|
|
docker-compose up -d
|
|
```
|
|
|
|
---
|
|
|
|
## Directory Structure
|
|
```
|
|
├── docker-compose.yml
|
|
├── Dockerfile
|
|
├── post_upload.sh
|
|
└── files/
|
|
├── msvcam1/ # uploads from camera 1
|
|
├── msvcam2/ # uploads from camera 2
|
|
└── current/ # latest .avif images (msvcam1.avif, msvcam2.avif, ...)
|
|
```
|
|
|
|
---
|
|
|
|
## How It Works
|
|
1. Cameras upload images via FTPS into `files/msvcamN/` folders.
|
|
2. `post_upload.sh` periodically checks for the newest image in each folder.
|
|
3. If the newest image has changed (SHA256 hash comparison), it is converted to `.avif` format and saved to `files/current/` as `msvcamN.avif`.
|
|
4. The `current/` directory can be served directly by a web server (e.g., Nginx) for live display.
|
|
|
|
---
|
|
|
|
## Example Nginx Integration
|
|
See [MSV Webcam Frontend](https://git.mosad.xyz/localhorst/msv-webcam-frontend)
|
|
|
|
---
|
|
|
|
## Requirements
|
|
- Docker
|
|
- Docker Compose
|