No description
  • Go 90.3%
  • Shell 4.2%
  • Dockerfile 3.4%
  • PowerShell 2.1%
Find a file
renovate[bot] 494ea14699
Update actions/checkout action to v6 (#10)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-07-22 22:57:11 +02:00
.github/workflows Update actions/checkout action to v6 (#10) 2026-07-22 22:57:11 +02:00
cmd/compressor Store Skipped files 2026-01-04 14:13:13 +01:00
k8s big commit 2025-10-17 17:43:17 +02:00
.dockerignore add pkgbuild 2025-10-17 20:34:46 +02:00
.gitignore add pkgbuild 2025-10-17 20:34:46 +02:00
.SRCINFO add pkgbuild 2025-10-17 20:34:46 +02:00
build_docker.ps1 add pkgbuild 2025-10-17 20:34:46 +02:00
compressor.service Fix command, to work with other formats 2026-01-04 13:49:15 +01:00
docker-compose.yml big commit 2025-10-17 17:43:17 +02:00
Dockerfile Update nvidia/cuda Docker tag to v13.2.1 (#8) 2026-07-22 22:46:38 +02:00
go.mod big commit 2025-10-17 17:43:17 +02:00
go.sum big commit 2025-10-17 17:43:17 +02:00
install.sh Fix output checking 2026-01-04 14:07:12 +01:00
PKGBUILD Store Skipped files 2026-01-04 14:13:13 +01:00
Readme.md add pkgbuild 2025-10-17 20:34:46 +02:00
renovate.json Add renovate.json 2025-11-01 11:57:38 +00:00

Compressor is a lightweight folder watcher that transcodes videos with ffmpeg.

Features

  • Watches a single level input directory and schedules new files for compression.
  • Renames files with a .processing suffix to coordinate multiple replicas.
  • Runs the configured ffmpeg command ( GPU friendly defaults supplied ).
  • Writes results into an output directory and optionally deletes sources.
  • Exposes a /status endpoint that returns HTTP 200 for health checks.

Configuration

Environment variables drive the runtime configuration. Defaults are shown in parentheses.

Variable Description
INPUT_DIR (/input) Directory to scan and watch for new videos.
OUTPUT_DIR (/output) Directory where encoded files are written.
VIDEO_EXTENSIONS (.mp4,.mkv,.mov,.avi,.flv,.wmv,.m4v,.webm,.ts) Comma separated list of extensions that should be processed.
FFMPEG_BIN (ffmpeg) Binary to invoke.
FFMPEG_COMMAND Arguments passed to ffmpeg. Must include {{input}} and {{output}} placeholders. Default: -y -hwaccel cuda -hwaccel_device 0 -i {{input}} -c:v hevc_nvenc -qp 25 -preset p6 -gpu 0 -b_qfactor 1.1 -b_ref_mode middle -bf 3 -g 250 -i_qfactor 0.75 -max_muxing_queue_size 1024 -multipass 1 -rc vbr -rc-lookahead 20 -temporal-aq 1 -tune hq -c:a aac -af volume=2.0 {{output}}
FFMPEG_COMMAND_CPU CPU fallback arguments if GPU not detected. Default: -y -i {{input}} -c:v libx264 -preset slow -crf 22 -c:a aac {{output}}
OUTPUT_EXTENSION (.mp4) Extension applied to the output file name.
DELETE_SOURCE (false) When true, removes the processed input file instead of restoring it.
PROCESSING_SUFFIX (.processing) Suffix appended while a file is in flight.
MAX_CONCURRENT (1) Number of concurrent transcodes. Consider GPU capacity when raising.
QUEUE_SIZE (128) Work queue buffer length.
FILE_STABILITY_DURATION (3s) How long a file size must remain unchanged before processing.
RESCAN_INTERVAL (30s) Periodic full directory rescan interval.
PORT (8080) Port for the HTTP /status endpoint.

Placeholders are shell escaped before the command line is parsed, so paths containing spaces are handled safely.

Installation

Arch Linux (AUR)

Build and install from source:

git clone https://github.com/meisterlala/compressor.git
cd compressor
makepkg -si

This will:

  • Install the compressor binary to /usr/bin
  • Install the systemd user service to /usr/lib/systemd/user/
  • Install an example configuration file to /etc/compressor.env

After installation, copy the example config and modify it:

cp /etc/compressor.env ~/compressor.env
# Edit ~/compressor.env as needed
systemctl --user enable compressor.service
systemctl --user start compressor.service

Manual Installation

For development or manual installation:

git clone https://github.com/meisterlala/compressor.git
cd compressor
./install.sh

This builds the binary locally and sets up the user service.

Running Locally

Container Notes

  • Mount the hot folder to /input and the destination to /output.
  • Expose the health endpoint through your orchestrator: http://<host>:8080/status.
  • Provide GPU-capable ffmpeg binaries in the image (for example via CUDA base images).

Docker

Build and run locally with GPU:

docker build -t compressor .
docker run --gpus all -v $(pwd)/test_input:/input -v $(pwd)/test_output:/output -p 8080:8080 compressor

Docker Compose

docker-compose up --build

Kubernetes

Apply the YAMLs:

kubectl apply -f k8s/

This creates PVCs for input/output volumes. Mount your persistent volumes accordingly. The deployment requests 1 GPU.

Health Endpoint

  • GET /status200 OK with body ok

The watcher logs every successful encode with source and destination paths.