Status : IMPLEMENTEE
Jellyfin (192.168.1.199) dispose d'une carte graphique permettant l'acceleration materielle pour le transcodage video. L'objectif est de creer une API REST simple pour exposer les fonctionnalites ffmpeg aux services du reseau prive.
ffmpeg-api/
├── src/
│ ├── index.ts # Point d'entree API
│ ├── routes/
│ │ ├── health.ts # Healthcheck
│ │ ├── transcode.ts # Endpoints transcodage
│ │ ├── probe.ts # Analyse fichiers media
│ │ └── thumbnail.ts # Generation miniatures
│ ├── services/
│ │ ├── ffmpeg.ts # Wrapper ffmpeg
│ │ └── queue.ts # File d'attente jobs
│ └── utils/
│ └── validation.ts # Validation IPs privees
├── Dockerfile
├── docker-compose.yml
├── package.json
├── tsconfig.json
└── README.md
Verification de l'etat du service et de ffmpeg.
Analyse un fichier media et retourne les metadonnees.
{
"input": "/path/to/video.mp4"
}
Lance un transcodage video.
{
"input": "/path/to/source.mp4",
"output": "/path/to/output.mp4",
"codec": "h264_nvenc",
"preset": "fast",
"crf": 23
}
Genere une miniature.
{
"input": "/path/to/video.mp4",
"output": "/path/to/thumb.jpg",
"timestamp": "00:01:00"
}
Liste les jobs en cours.
Statut d'un job specifique.
Annule un job.
// Middleware validation IP
const isPrivateIP = (ip: string): boolean => {
const privateRanges = [
/^10\./,
/^172\.(1[6-9]|2[0-9]|3[0-1])\./,
/^192\.168\./,
/^127\./
];
return privateRanges.some(r => r.test(ip));
};
L'API ne sera pas exposee publiquement (pas de config nginx externe).
FROM oven/bun:1 as builder
WORKDIR /app
COPY package.json bun.lockb ./
RUN bun install --frozen-lockfile
COPY . .
FROM oven/bun:1-slim
WORKDIR /app
# Install ffmpeg avec support GPU
RUN apt-get update && apt-get install -y \
ffmpeg \
&& rm -rf /var/lib/apt/lists/*
COPY --from=builder /app .
EXPOSE 3200
CMD ["bun", "run", "src/index.ts"]
Note : Pour le support GPU NVIDIA, il faudra utiliser l'image nvidia/cuda ou ajouter les drivers.
version: '3.8'
services:
ffmpeg-api:
build: .
container_name: ffmpeg-api
restart: unless-stopped
ports:
- "3200:3200"
volumes:
- /mnt/media:/media:ro
- /mnt/output:/output
environment:
- NODE_ENV=production
- API_PORT=3200
# Pour GPU NVIDIA (si disponible)
# deploy:
# resources:
# reservations:
# devices:
# - driver: nvidia
# count: 1
# capabilities: [gpu]
http://jellyfin.local:3200 ou http://192.168.1.199:3200