A FastAPI service that uploads videos to MinIO, queues transcoding jobs with Celery, processes videos with FFmpeg, and reports job progress through Server-Sent Events.
- Accepts MP4 uploads through an HTTP API.
- Stores the original video in MinIO.
- Creates one Celery job per configured resolution.
- Transcodes videos to 480p, 720p, 1080p, and 4K by default.
- Stores transcoded files back in MinIO.
- Tracks each resolution status in Redis.
- Streams job status updates from the API.
- FastAPI
- Celery
- Redis
- MinIO
- FFmpeg
- Docker Compose
- Python 3.10+
- Docker and Docker Compose
- FFmpeg installed on the machine running the Celery worker
Start Redis and MinIO:
docker compose up -dCreate and activate a virtual environment:
python -m venv venv
source venv/bin/activateInstall dependencies:
pip install -r requirements.txtStart the API:
uvicorn server:app --reloadStart the Celery worker in another terminal:
celery -A tasks.celery_client worker --loglevel=infoGET /Returns:
{
"message": "Hello World"
}POST /uploadForm field:
file: MP4 video file
Example:
curl -X POST http://localhost:8000/upload \
-F "[email protected]"Response:
{
"job_id": "..."
}GET /status/{job_id}Example:
curl -N http://localhost:8000/status/<job_id>Example event payload:
{
"480": "done",
"720": "done",
"1080": "failed",
"4k": "done"
}Default settings are in config.py:
| Setting | Default |
|---|---|
REDIS_URL |
redis://localhost:6379 |
MINIO_HOST |
localhost |
MINIO_PORT |
9000 |
MINIO_ACCESS_KEY |
minioadmin |
MINIO_SECRET_KEY |
minioadmin |
MINIO_BUCKET |
videos |
Resolutions are also configured in config.py.
- MinIO console runs at
http://localhost:9001with the default credentials fromdocker-compose.yml. - Uploaded and transcoded files are stored in the configured MinIO bucket.
- Local virtual environments, Python cache files, logs, and generated media files are ignored by Git.