# FFmpeg Media — Future Features Roadmap

Internal planning document. Not shipped with releases.

Last updated: 2026-03-07


## 1. Multi-Language Subtitle Orchestration

### Phase 1 — Whisper Language Improvements (1.1)

**Goal:** Improve single-language transcription UX.

- [ ] WhisperProcessor: output naming with language suffix (`video_en.srt`)
- [ ] TranscribeForm: language dropdown before generating transcript
- [ ] TranscribeForm: display existing transcripts with detected language
- [ ] Config option `output_naming: 'language_suffix' | 'default'`

Estimated effort: 2-3 hours. No new dependencies.

### Phase 2 — Multi-Language Queue Orchestration (1.2)

**Goal:** Queue multiple Whisper jobs (one per language) from a single trigger.

- [ ] New service: `TranscriptionOrchestrator`
  - Accepts array of language codes
  - Enqueues per-language WhisperProcessor jobs
  - Tracks completion, merges results, invalidates player cache
- [ ] Extend ConvertedVideoFormatter settings: `subtitle_languages: ['en', 'fr', 'de']`
- [ ] Event listener on `ConversionCompletedEvent` to spawn subtitle jobs
- [ ] Queue item payload extension: `languages` array

Estimated effort: 8-12 hours. No external dependencies.

### Phase 3 — External Translation Providers (1.3+)

**Goal:** Translate Whisper output to arbitrary target languages.

- [ ] Abstract `TranslationServiceInterface`
- [ ] Adapter implementations:
  - LibreTranslate (self-hosted, FOSS)
  - DeepL API
  - Google Cloud Translation
  - OpenAI GPT (via chat completion)
- [ ] Config: `translation_provider`, `translation_api_key` (Key module integration)
- [ ] Pipeline: Whisper SRT -> parse segments -> translate text -> write target SRT
- [ ] Credential security: use Key module or environment variables, never plaintext config

Estimated effort: 8-15 hours depending on provider count.

### Phase 4 — Player Language Preferences (1.3+)

**Goal:** Smart subtitle track selection in the player.

- [ ] Store user language preference in localStorage
- [ ] Auto-select subtitle track matching browser `navigator.language`
- [ ] Subtitle upload form (add external SRT/VTT from dashboard)
- [ ] Dashboard: subtitle management panel per media (view/delete/regenerate per language)

Estimated effort: 6-10 hours.

### Database Considerations

Current `ffmpeg_media_outputs` table stores subtitle files as multi-value entries.
Language is extracted from filename at runtime (`SubtitleHandler::extractLanguageFromFilename()`).

If query performance becomes an issue at scale (>1000 subtitle tracks):
- Add optional `language VARCHAR(16) NULL` column to `ffmpeg_media_outputs`
- Add index: `KEY subtitle_language (output_type, language)`
- Populate retroactively from filename parsing
- Decision deferred until actual performance data exists.


## 2. Vidstack Bundle Optimization

### Analysis Result (2026-03-07)

Current bundle: 365KB minified (~95KB gzipped).

Selective UI element imports are **not possible** — Vidstack does not export
individual elements via package.json. The `vidstack/player/ui` import is a
thin wrapper (~4.4KB) over shared chunks that are required by the layout
template regardless.

**Decision:** No action. Bundle size is acceptable for a full-featured video
player with HLS/DASH/keyboard/a11y support.

**Future option:** If Vidstack adds granular exports or an unplugin for
build-time tree-shaking, revisit. Track: https://github.com/vidstack/player


## 3. Advanced Player Features

Potential enhancements for future releases:

- [ ] Chapters support (VTT chapters -> Vidstack chapter markers)
- [ ] Thumbnail preview on seek (sprite sheet generation via FFmpeg)
- [ ] A/B loop for educational content
- [ ] Playback speed persistence per user
- [ ] Watch progress tracking (resume where left off, server-side)
- [ ] Analytics integration (play count, watch duration, drop-off points)
- [ ] Audio-only mode with waveform visualization


## 4. Streaming Enhancements

- [ ] Low-latency HLS (LL-HLS) with partial segments
- [ ] CMAF (Common Media Application Format) output
- [ ] DRM integration (Widevine/FairPlay) via Vidstack DRM providers
- [ ] Live streaming support (ingest + transcode + HLS output)
- [ ] CDN token authentication rotation automation


## 5. AI/ML Pipeline Extensions

- [ ] Speaker diarization (who said what) via pyannote.audio
- [ ] Content moderation (NSFW detection) as post-processing step
- [ ] Auto-generated video descriptions for accessibility (alt text)
- [ ] Scene detection and auto-chaptering
- [ ] Thumbnail selection via quality scoring (sharpness, faces, composition)
