No description
  • Python 96.6%
  • Dockerfile 3.4%
Find a file
2026-06-20 22:34:55 +03:00
.github/workflows first commit 2026-06-20 20:48:57 +03:00
app first commit 2026-06-20 20:48:57 +03:00
assets/music first commit 2026-06-20 20:48:57 +03:00
docs first commit 2026-06-20 20:48:57 +03:00
tests Add unit tests for authentication, media fetching, metrics, music selection, and rendering 2026-06-20 22:34:55 +03:00
.coverage Add unit tests for authentication, media fetching, metrics, music selection, and rendering 2026-06-20 22:34:55 +03:00
.dockerignore first commit 2026-06-20 20:48:57 +03:00
.env.example first commit 2026-06-20 20:48:57 +03:00
.gitignore first commit 2026-06-20 20:48:57 +03:00
Dockerfile first commit 2026-06-20 20:48:57 +03:00
pyproject.toml first commit 2026-06-20 20:48:57 +03:00
README.md first commit 2026-06-20 20:48:57 +03:00
requirements.txt first commit 2026-06-20 20:48:57 +03:00

sharevent-videogen

Auto highlight-video render microservice for ShareVent (the gallery_auto_video module). FastAPI + ffmpeg/moviepy. Given a set of BE-signed media URLs it renders one polished mp4 — Ken Burns photo segments, trimmed video clips, crossfade transitions, intro/outro cards and a royalty-free music bed — and writes it (plus a poster thumbnail) into the shared uploads store the backend reads back from.

The service is stateless apart from the rendered output: all persistence, gating, versioning and scheduling live in sharevent-be. Auth is a shared bearer token (VIDEOGEN_AUTH_TOKEN), fail-closed in production.

Endpoints

Method Path Auth Purpose
GET /healthz none Liveness + resolved encoder (cpu/cuda).
POST /render bearer Render one highlight mp4 (see app/schemas.py).
GET /metrics none Prometheus metrics (no-op if client absent).

GPU / CPU

VIDEOGEN_DEVICE=auto (default) uses NVENC (h264_nvenc) + -hwaccel cuda when an NVIDIA GPU and an NVENC-capable ffmpeg are present, else falls back to libx264 on the CPU. Force with cpu or a GPU index. The path is probed once at boot and reported by /healthz.

Run locally (CPU)

python -m venv .venv && . .venv/bin/activate
pip install -r requirements.txt
VIDEOGEN_ENV=development uvicorn app.main:app --port 5002

Tests

pytest          # pure planner + device + health/auth plumbing (no GPU/ffmpeg)

The heavy render path (moviepy + ffmpeg) is exercised on the image build / GPU host, mirroring sharevent-faces. CI byte-compiles app + tests.

Music

Bundled royalty-free tracks live under assets/music/<mood>/ — see assets/music/LICENSES.md. Hosts may also upload their own track (BE passes it as track_url). See docs/ARCHITECTURE.md for the full pipeline.