Self-hosted Opus Clip alternative — reels.biba.live
Go to file
Sebastjan Artič 1cc8e8be35 MXF/MPG broadcast format support: handle multichannel audio properly
Problem: MXF and MPG files (TV broadcast formats) often contain:
- Multiple audio streams (4-8 streams for different language tracks)
- Multichannel layouts (5.1, 7.1) instead of stereo
- Default ffmpeg behavior was -c:a aac without channel limit, which
  meant multichannel got transcoded as multichannel AAC, overwriting
  what should have been clean stereo

Solution:

1. get_audio_streams() helper probes all audio streams with ffprobe
   - Returns codec, channels, sample_rate, language, layout for each

2. build_audio_args() picks best stream + downmix:
   - Prefers first 2-channel stereo stream (usually main mix)
   - Falls back to first stream if none are 2-ch
   - Always: -ac 2 (force stereo downmix), -ar 48000, -c:a aac, -b:a 192k
   - Bitrate raised from 128k to 192k for music quality

3. Smart trim path now detects broadcast formats:
   - .mxf, .mpg, .mpeg, .ts, .m2ts, .mts → transcode (not stream copy)
   - Standard MP4/MOV → stream copy (faster, lossless)

4. Pre-conversion step for broadcast files without trim:
   - Even without --start/--duration, MXF/MPG get converted to MP4
   - Same audio handling as trim path

5. Main render adds explicit -map 0✌️0 -map 0🅰️0? -ac 2 to ensure
   only first video and first audio stream get encoded, with stereo

6. ACR recognize also gets -map 0🅰️0 -ac 2 for MXF compatibility

7. UI accepts: video/*,.mxf,.mpg,.mpeg,.ts,.m2ts,.mts

8. Upload limit raised: 2GB → 10GB (MXF files are large)

This means a TV broadcast MXF with [SLO/EN/DE language tracks] now
correctly outputs stereo MP4 with the main language track preserved.
2026-04-29 14:38:48 +00:00
app ACRCloud auto-recognition: never block uploads, fall back to fingerprinting 2026-04-29 14:24:53 +00:00
scripts MXF/MPG broadcast format support: handle multichannel audio properly 2026-04-29 14:38:48 +00:00
templates MXF/MPG broadcast format support: handle multichannel audio properly 2026-04-29 14:38:48 +00:00
.env.example Initial: reels clipper app 2026-04-28 15:28:22 +00:00
.gitignore Initial: reels clipper app 2026-04-28 15:28:22 +00:00
docker-compose.yml Initial: reels clipper app 2026-04-28 15:28:22 +00:00
Dockerfile Add Deno runtime for yt-dlp YouTube nsig challenge solving 2026-04-28 16:05:09 +00:00
README.md Initial: reels clipper app 2026-04-28 15:28:22 +00:00
requirements.txt ACRCloud auto-recognition: never block uploads, fall back to fingerprinting 2026-04-29 14:24:53 +00:00

Reels Clipper · biba.live

Self-hosted Opus Clip alternativa za FOLX TV / PTC. Pretvori 16:9 video v 9:16 reels/shorts/tiktok format z auto face tracking, podnapisi (sl/de/en) in avto-detekcijo refrena v glasbenih pesmih.

Features

  • 📤 Drag & drop upload (do 2 GB)
  • 📺 YouTube URL paste (yt-dlp)
  • 🎯 Smart reframe: track (face follow), center, blur (za glasbo)
  • 🎵 Auto-chorus detection (Whisper + energy hibrid)
  • 📝 Burned-in podnapisi (faster-whisper, multi-jezik)
  • 🎨 3 stili podnapisov: reels, yellow (MrBeast), minimal
  • 🔐 HTTP Basic Auth
  • 📊 Real-time progress (Server-Sent Events)
  • 📦 Docker / Coolify ready

Quick start (lokalno)

docker compose up --build
# odpri http://localhost:8000

Default login: sebastjan / nastavi AUTH_PASS v .env.

Coolify deploy

  1. V Coolify ustvari nov projekt → Docker Compose iz tega repoja
  2. Domena: reels.biba.live
  3. Env vars:
    AUTH_USER=sebastjan
    AUTH_PASS=<močno geslo>
    MAX_UPLOAD_MB=2000
    
  4. Volume reels_data se ustvari avtomatsko
  5. Deploy → Coolify postavi Traefik reverse proxy + SSL via Let's Encrypt

Pipeline

Upload / YouTube
       ↓
[ yt_download.py ]    ← samo če YouTube
       ↓
[ find_chorus.py ]    ← samo če auto_chorus=true (Whisper + RMS analiza)
       ↓
[ reframe.py ]        ← 16:9 → 9:16 (track / center / blur)
       ↓
[ subtitle.py ]       ← Whisper transkripcija + burn-in
       ↓
   reel.mp4

API

  • POST /api/upload — multipart file upload, vrne job_id
  • POST /api/youtube — JSON {url, mode, lang, ...}
  • POST /api/process — start processing za uploaded job
  • GET /api/jobs — list vseh
  • GET /api/jobs/{id} — status
  • GET /api/stream/{id} — SSE stream progress
  • GET /api/download/{id} — final reel
  • DELETE /api/jobs/{id} — pobriši

Dependencies

  • FFmpeg (system)
  • faster-whisper (transkripcija)
  • OpenCV (face detection)
  • yt-dlp (YouTube)
  • FastAPI + uvicorn (server)