Stratégie d'Optimisation Média - Stack *arr + Tdarr¶
Date: 2026-02-13
Objectif: Maximiser la disponibilité des médias tout en optimisant les formats pour une lecture directe fluide sur réseau local et distant.
📊 Analyse Hardware Actuelle¶
Capacités Intel HD Graphics 530 (Quick Sync 6.0)¶
| Opération | H.264 | HEVC 8-bit | HEVC 10-bit | Vitesse |
|---|---|---|---|---|
| Encode | ✅ 4K60 | ✅ 4K30 | ❌ Software | 6-8x RT |
| Decode | ✅ 4K60 | ✅ 4K60 | ⚠️ 4K30 | N/A |
Limitations critiques:
- HEVC 10-bit : Hardware decode OK, mais software encode seulement
- Impact : 22.5% des fichiers actuels (43/191) nécessitent software encode
- Performance software : ~2-3x RT (vs 6-8x hardware)
Capacité simultanée:
- 1 stream HW : 6-8x temps réel, CPU 5-8%
- 2 streams HW : 4-5x temps réel, CPU 10-15%
- 4 streams HW : 2-3x temps réel, CPU 15-25%
- Verdict: Support aisé de 2-3 lectures parallèles (objectif atteint)
État Bibliothèque (191 fichiers)¶
| Codec | Nombre | % | Support HD 530 |
|---|---|---|---|
| H.264 | 142 | 74.3% | ✅ Full HW |
| HEVC 8-bit | 6 | 3.1% | ✅ Full HW |
| HEVC 10-bit | 43 | 22.5% | ⚠️ HW decode, SW encode |
| VC-1 | 1 | 0.5% | ⚠️ SW decode |
🎯 Formats Optimaux par Use Case¶
1. Lecture Réseau Local 4K¶
Format Target:
- Vidéo: HEVC 8-bit, Main Profile, Level 5.1
- Résolution: 3840x2160 (4K UHD)
- Bitrate: 15-25 Mbps (optimal qualité/taille)
- Audio: AAC 2.0 256k (stéréo downmix)
- Container: MKV
- Colorspace: BT.709 SDR (strip HDR)
Justification:
- ✅ Full hardware encode/decode HD 530
- ✅ Taille optimale : ~6-10 GB pour film 2h (vs 20-40 GB source)
- ✅ Qualité visuelle excellente (transparent vs source pour 95% contenu)
- ✅ Direct play garanti sur tous clients Jellyfin
- ✅ Bande passante réseau confortable (20 Mbps = 2.5 Mo/s << 150 Mo/s WiFi)
2. Lecture Distante 2K / Mobile¶
Option A : Fichier Dédié (Recommandé)
- Vidéo: H.264 High Profile, Level 4.1
- Résolution: 2560x1440 ou 1920x1080
- Bitrate: 6-10 Mbps
- Audio: AAC 2.0 192k
- Container: MP4 (meilleure compatibilité)
Option B : Transcoding à la Volée
- Source : HEVC 8-bit 4K → Transcode → H.264 2K
- Performance HD 530 : 4-6x RT (acceptable)
- Inconvénient : Latence démarrage ~2-3s
Recommandation: Option A (fichier dédié) pour :
- Collections fréquemment regardées
- Séries complètes
- Pas de latence transcoding
- Support hors ligne mobile
3. Audio - Strip 5.1 → 2.1¶
Constat:
- 95% clients : lecture sur TV (stéréo), laptop, mobile (stéréo)
- Systèmes 5.1 : rares et sophistiqués (détection automatique)
- Downmix 5.1 → 2.0 : Jellyfin le fait déjà en temps réel si nécessaire
Stratégie:
- Garder 5.1 → 2.0 stéréo downmix (pas 2.1)
- Utiliser
libfdk_aacavec matrice downmix intelligente - Bitrate : 256k AAC (transparent pour 99% contenu)
Exceptions:
- Contenu musical (concerts) : garder 5.1 original
- Collections premium (Blu-ray remux) : version séparée 5.1
4. Audio Multi-langues¶
Règle de Conservation:
- ✅ Garder: Audio original (VO) + Français (VF/VFF/VOF)
- ❌ Supprimer: Commentaires, descriptive audio, autres langues
Ordre des pistes:
- Piste 1 : Français (VFF/VOF) - Default
- Piste 2 : Original (VO)
Bénéfice:
- Réduction ~30-50% taille (6-8 pistes → 2 pistes)
- Fichiers 8 GB → 5-6 GB typiquement
5. Sous-titres¶
Règle de Conservation:
- ✅ Garder: Français (forced + full)
- ✅ Garder: Anglais (fallback si FR manquant)
- ❌ Supprimer: Autres langues, commentaires
Format préféré: SRT (texte, léger)
- Convertir PGS/VobSub → SRT si possible
- Sinon garder PGS en dernier recours
6. HDR → SDR¶
Stratégie:
- ✅ Strip HDR systématiquement
- Raison : Aucun affichage HDR dans setup actuel
- Conversion : HDR PQ/HLG → SDR BT.709
- Tonemapping : BT.2390 (algorithme Intel VPP)
Bénéfice:
- Compatibilité universelle
- Pas de problème de couleurs délavées sur TV SDR
- Métadonnées HDR retirées = fichier plus propre
📦 Stratégie Radarr/Sonarr - Profils Quality¶
Philosophie Générale¶
Objectif: Maximiser disponibilité → Accepter plus de formats
Principe:
- Priorité Haute: Formats nécessitant peu/pas de traitement
- H.264 1080p/2160p avec audio AAC
- HEVC 8-bit avec audio AAC
- Priorité Moyenne: Formats nécessitant traitement audio
- H.264/HEVC avec DTS, EAC3, TrueHD
- Priorité Basse: Formats nécessitant réencodage vidéo
- HEVC 10-bit (software encode)
- Codecs legacy (VC-1, MPEG2)
Profiles Radarr Proposés¶
Profile 1 : "4K Optimized" (priorité maximale)¶
Objectif: Acquisition 4K pour traitement Tdarr → HEVC 8-bit SDR
quality_profiles:
- name: 4K-Optimized-Tdarr
upgrade:
allowed: true
until_quality: Bluray-2160p
until_score: 10000
qualities:
# 4K : Bluray > WEB
- name: Bluray-2160p # Score: 2000
- name: WEBDL-2160p # Score: 1800
- name: WEBRip-2160p # Score: 1700
# Fallback HD si 4K indisponible
- name: Bluray-1080p # Score: 1000
- name: WEBDL-1080p # Score: 800
Custom Formats Scoring:
- HEVC : +200 (privilégier, moins de travail Tdarr)
- H.264 : +100 (acceptable)
- HEVC 10-bit : -300 (décourager mais accepter)
- DTS/TrueHD : 0 (neutre, Tdarr gérera)
- AAC audio : +300 (parfait, pas de traitement)
Profile 2 : "HD French Priority" (contenu VF)¶
quality_profiles:
- name: HD-French-Priority
upgrade:
allowed: true
until_quality: Bluray-1080p
until_score: 10000
qualities:
- name: Bluray-1080p
- name: WEBDL-1080p
- name: Bluray-720p
Custom Formats Scoring:
- VFF : +1800
- VOF : +1750
- MULTi original+FR : +500
Profiles Sonarr Proposés¶
Profile 1 : "4K Series Optimized"¶
quality_profiles:
- name: 4K-Series-Optimized
upgrade:
allowed: true
until_quality: WEBDL-2160p # Séries rarement en Bluray
until_score: 10000
qualities:
- name: WEBDL-2160p
- name: WEBRip-2160p
- name: WEBDL-1080p # Fallback
Profile 2 : "HD Series French"¶
quality_profiles:
- name: HD-Series-French
upgrade:
allowed: true
until_quality: WEBDL-1080p
until_score: 10000
qualities:
- name: WEBDL-1080p
- name: WEBRip-1080p
- name: HDTV-1080p # Fallback rapide pour séries en cours
Custom Formats Additions¶
Nouveaux CF à créer:
-
Audio AAC Ready
- Regex :
/\b(AAC[ ._-]?2\.0|AAC[ ._-]?Stereo)\b/i - Score : +300 (fichier "ready to use")
- Regex :
-
Video Optimized Codec
- Regex :
/\b(HEVC|[Hh]265|x265)\b/ET PAS/10-?bit|10bit/ - Score : +200 (HEVC 8-bit optimal)
- Regex :
-
Needs Audio Remux Only
- Regex :
/\b(DTS|TrueHD|EAC3|DD\+?)\b/ - Score : +100 (traitement léger Tdarr)
- Regex :
-
Needs Heavy Processing
- Regex :
/\b(10-?bit|10bit|HDR|DoVi|VC-?1)\b/ - Score : -300 (décourager, pas bloquer)
- Regex :
🔄 Architecture Tdarr¶
Flux de Traitement¶
┌─────────────────────────────────────────────────────────────┐
│ Radarr/Sonarr │
│ ↓ Télécharge fichier source (priorité formats optimisés) │
├─────────────────────────────────────────────────────────────┤
│ Tdarr - Queue Library Scan │
│ ↓ Détection : codec vidéo, audio, sous-titres, HDR │
├─────────────────────────────────────────────────────────────┤
│ Tdarr - Decisioning (Plugins conditionnels) │
│ ├─ [Check] Déjà optimisé ? → Skip │
│ ├─ [Audio] DTS/EAC3/TrueHD ? → AAC 2.0 256k │
│ ├─ [Video] H.264 4K/HEVC 8-bit ? → Copy (pas réencodage) │
│ ├─ [Video] HEVC 10-bit 4K ? → HEVC 8-bit 4K (réencodage) │
│ ├─ [Audio] Strip langues non FR/VO │
│ ├─ [Subs] Strip langues non FR/EN │
│ └─ [HDR] Strip HDR → SDR BT.709 │
├─────────────────────────────────────────────────────────────┤
│ Tdarr - Transcoding Worker (Intel HD 530) │
│ ↓ FFmpeg VAAPI hardware transcode │
│ ↓ Temp : /mnt/scratch/tdarr-temp/ │
├─────────────────────────────────────────────────────────────┤
│ Tdarr - Health Check │
│ ├─ Vérifier : fichier lisible, pas corrompu │
│ ├─ Vérifier : taille cohérente (>50% source si réencodé) │
│ └─ Comparer : durée identique source/output │
├─────────────────────────────────────────────────────────────┤
│ Tdarr - Replace Original │
│ ├─ Backup optionnel → /mnt/media/.tdarr-originals/ │
│ └─ Remplacer fichier source par version optimisée │
├─────────────────────────────────────────────────────────────┤
│ Jellyfin - Auto Rescan │
│ ↓ Détection nouveau fichier → Update library │
└─────────────────────────────────────────────────────────────┘
Plugins Tdarr Personnalisés¶
Plugin 1 : "Media Optimizer - Decisioning"¶
Rôle: Décider si traitement nécessaire
// Pseudo-code
function shouldProcess(file) {
// Skip si déjà optimisé
if (isOptimized(file)) return SKIP;
// Calculer score de priorité
let priority = 0;
// Audio à convertir : Haute priorité
if (hasNonAACaudio(file)) priority += 100;
// Vidéo à réencoder : Moyenne priorité
if (isHEVC10bit(file) || isH264Above30Mbps(file)) priority += 50;
// Audio/subs multilingues : Basse priorité
if (hasMultipleLanguages(file)) priority += 10;
return priority;
}
Plugin 2 : "Media Optimizer - Audio Remux"¶
FFmpeg Command:
ffmpeg -i input.mkv \
-map 0:v -c:v copy \
-map 0:a:fr? -map 0:a:original? \
-c:a libfdk_aac -ac 2 -b:a 256k -af "pan=stereo|FL=FC+0.30*FL+0.30*BL+0.30*LFE|FR=FC+0.30*FR+0.30*BR+0.30*LFE" \
-map 0:s:fre? -map 0:s:eng? -c:s copy \
-metadata:s:a:0 language=fra -metadata:s:a:0 title="Français Stéréo" \
-metadata:s:a:1 language=original -metadata:s:a:1 title="Original Stéréo" \
output.mkv
Actions:
- ✅ Copy vidéo (pas de réencodage)
- ✅ Convertir audio → AAC 2.0 avec downmix 5.1 intelligent
- ✅ Garder 2 pistes max : FR + Original
- ✅ Garder sous-titres FR + EN
Plugin 3 : "Media Optimizer - Video Transcode 4K"¶
Conditions: HEVC 10-bit OU H.264 >30Mbps OU HDR
FFmpeg Command (HEVC 10-bit → HEVC 8-bit SDR):
ffmpeg -hwaccel vaapi -hwaccel_device /dev/dri/renderD128 \
-i input.mkv \
-vf "format=nv12,hwupload,scale_vaapi=w=3840:h=2160:format=nv12" \
-c:v hevc_vaapi -profile:v main -qp 23 -bf 3 \
-pix_fmt nv12 -colorspace bt709 -color_primaries bt709 -color_trc bt709 \
-map 0:a -c:a copy \
-map 0:s -c:s copy \
output.mkv
Actions:
- ✅ Hardware encode VAAPI
- ✅ HEVC 8-bit Main Profile
- ✅ SDR BT.709 (strip HDR)
- ✅ QP 23 (~18-25 Mbps pour 4K, transparent)
Plugin 4 : "Media Optimizer - Create 2K Version"¶
Optionnel - Pour contenu fréquemment accédé
FFmpeg Command:
ffmpeg -hwaccel vaapi -hwaccel_device /dev/dri/renderD128 \
-i input_4k.mkv \
-vf "scale_vaapi=w=1920:h=1080:format=nv12" \
-c:v h264_vaapi -profile:v high -level 4.1 -qp 21 \
-c:a libfdk_aac -ac 2 -b:a 192k \
-map 0:a:0 -map 0:s:0 \
"${filename}_1080p.mp4"
Stockage: Même dossier que source avec suffixe _1080p.mp4
📋 Plan d'Implémentation¶
Phase 1 : Préparatifs (1 jour)¶
1.1 - Mise à jour Recyclarr
# Backup configs actuelles
cp /mnt/lxc-data/100-media/recyclarr/configs/radarr-multi-profiles.yml{,.bak}
cp /mnt/lxc-data/100-media/recyclarr/configs/sonarr-multi-profiles.yml{,.bak}
# Éditer configs avec nouveaux profiles
# (voir section "Profiles Radarr/Sonarr Proposés")
1.2 - Installation Tdarr
# Créer répertoires
pct exec 100 -- mkdir -p /opt/docker/tdarr/{server,configs,logs}
pct exec 100 -- mkdir -p /mnt/scratch/tdarr-temp
pct exec 100 -- mkdir -p /mnt/media/.tdarr-originals
# Ajouter service à docker-compose.yml
# (voir docker-compose configuré ci-dessous)
1.3 - Validation Hardware
# Vérifier VAAPI fonctionnel
pct exec 100 -- docker exec jellyfin /usr/lib/jellyfin-ffmpeg/ffmpeg \
-hwaccel vaapi -hwaccel_device /dev/dri/renderD128 \
-f lavfi -i testsrc=duration=10:size=3840x2160:rate=30 \
-c:v hevc_vaapi -qp 23 -t 5 /tmp/test_4k_hevc.mkv
# Résultat attendu : >3x temps réel, pas d'erreur
Phase 2 : Configuration Tdarr (2-3 heures)¶
2.1 - Setup Plugins
- Accéder WebUI Tdarr :
http://192.168.1.100:8265 - Onglet Plugins → Créer 3 plugins personnalisés :
- Media Optimizer - Audio Remux
- Media Optimizer - Video Transcode 4K
- Media Optimizer - Create 2K Version (optionnel)
2.2 - Configuration Libraries
Library: Movies 4K
Source: /media/movies
Cache: /temp/movies
Filters:
- Include: *.mkv, *.mp4, *.avi
- Min size: 500 MB
Flow:
1. Media Optimizer - Decisioning
2. Conditional: Media Optimizer - Audio Remux (si audio non-AAC)
3. Conditional: Media Optimizer - Video Transcode 4K (si HEVC 10-bit ou H.264 >30Mbps)
4. Health Check
Options:
- Hold after transcode: ✅
- Overwrite source: ✅
- Create backup: ✅ (/mnt/media/.tdarr-originals/)
2.3 - Scheduling
Transcode Schedule:
- 02h00-08h00: 100% CPU (4 workers)
- 08h00-23h00: 25% CPU (1 worker, basse priorité)
- 23h00-02h00: 50% CPU (2 workers)
Phase 3 : Test Pilote (1 semaine)¶
3.1 - Sélection Échantillon
# 10 films variés
- 3x 1080p H.264 + DTS (traitement audio seulement)
- 3x 1080p HEVC 10-bit (réencodage vidéo + audio)
- 2x 4K HEVC 8-bit + EAC3 (traitement audio seulement)
- 2x 4K HEVC 10-bit + TrueHD (réencodage vidéo + audio)
3.2 - Métriques à Valider
| Métrique | Target | Validation |
|---|---|---|
| Taille fichier | 40-60% réduction | du -h before/after |
| Qualité visuelle | Transparent (VMAF >92) | Visionnage + VMAF |
| Temps traitement | <40h pour biblio complète | Extrapolation |
| Direct play Jellyfin | 100% fichiers | Test lecture |
| Bande passante 4K | <25 Mbps | Dashboard Jellyfin |
3.3 - Validation Qualité
# VMAF score (objectif >92 = transparent)
ffmpeg -i original.mkv -i optimized.mkv -lavfi \
"libvmaf=log_fmt=json:log_path=vmaf.json" -f null -
# Résultat attendu :
# VMAF mean: >92 (excellent)
# VMAF min: >85 (acceptable dans scènes complexes)
Phase 4 : Déploiement Progressif (2-4 semaines)¶
4.1 - Traitement Bibliothèque Existante
Stratégie progressive :
# Pseudo-code priorité
Priority Queue:
1. Top 50 films fréquemment regardés (Jellyfin analytics)
2. Séries en cours de visionnage
3. Films 1080p H.264+DTS (traitement rapide, <15min/film)
4. Films 4K HEVC 8-bit (traitement rapide audio)
5. Films 4K HEVC 10-bit (traitement long, 30-60min/film)
6. Long tail (anciennes acquisitions)
Estimation temps:
- 142 H.264 + audio : ~35h (15min/film)
- 6 HEVC 8-bit : ~2h
- 43 HEVC 10-bit : ~30h (40min/film)
- Total : ~67h → 3-4 semaines en arrière-plan
4.2 - Acquisitions Nouvelles
Workflow automatisé :
Radarr/Sonarr télécharge → Complete
↓
Tdarr scan automatique (1h interval)
↓
Décision : Optimisation nécessaire ?
↓ Oui
Queue Tdarr → Traitement asynchrone
↓
Remplacement fichier source
↓
Jellyfin rescan automatique
Latence : 2-12h entre download et disponibilité optimisée
Acceptable : Non bloquant, fichier source directement lisible
Phase 5 : Monitoring & Ajustements (continu)¶
5.1 - Dashboards
Tdarr WebUI :
- Files processing : queue size, ETA
- Worker health : CPU usage, transcode speed
- Library statistics : % optimized, space saved
Jellyfin Dashboard :
- Playback : bitrate moyen, direct play vs transcode
- Activity : bande passante réseau, streams simultanés
5.2 - Alertes
Alerting:
- Tdarr queue >50 fichiers: Email (accumulation)
- Worker failed >3 fois: Email (problème VAAPI?)
- Library scan errors: Email
- Disk space <100 GB: Critique
5.3 - Optimisations
Après 1 mois, analyser :
- Logs Jellyfin : % direct play vs transcode
- Fichiers encore transcodés : pourquoi ? (codec manquant?)
- Bitrates moyens : ajuster QP si trop haut/bas
- Formats utilisateur : créer versions 2K si accès distant fréquent
📊 Résultats Attendus¶
Gains Espace Disque¶
| Type | Avant | Après | Économie |
|---|---|---|---|
| Film 1080p Bluray | 10 GB | 4-6 GB | 40-50% |
| Film 4K HEVC 10-bit | 20 GB | 8-12 GB | 40-50% |
| Série 1080p (saison) | 25 GB | 12-15 GB | 40-50% |
| Total bibliothèque | ~2 TB | ~1-1.2 TB | 40-50% |
Optimisation Bande Passante¶
| Usage | Avant | Après | Gain |
|---|---|---|---|
| Stream local 4K | 40-80 Mbps | 20-25 Mbps | 60% |
| Stream local 1080p | 20-30 Mbps | 8-12 Mbps | 60% |
| Transcoding nécessaire | 30% fichiers | 5% fichiers | 85% |
| Latence démarrage | 3-5s | <1s | 80% |
Performance Lecture¶
Objectifs :
- ✅ 100% direct play sur réseau local
- ✅ 95% direct play sur accès distant (avec versions 2K optionnelles)
- ✅ 2-3 lectures simultanées sans latence
- ✅ Seeking instantané (<500ms)
🔧 Docker Compose Tdarr¶
tdarr:
image: ghcr.io/haveagitgat/tdarr:latest
container_name: tdarr
restart: unless-stopped
network_mode: bridge
ports:
- 8265:8265 # WebUI
- 8266:8266 # Server port
environment:
- TZ=Europe/Paris
- PUID=1000
- PGID=1000
- UMASK_SET=002
- serverIP=0.0.0.0
- serverPort=8266
- webUIPort=8265
- internalNode=true
- inContainer=true
- nodeName=TdarrMainNode
- NVIDIA_VISIBLE_DEVICES=none
- ffmpegVersion=6
volumes:
- ./tdarr/server:/app/server
- ./tdarr/configs:/app/configs
- ./tdarr/logs:/app/logs
- /mnt/media:/media
- /mnt/scratch/tdarr-temp:/temp
devices:
- /dev/dri:/dev/dri
group_add:
- "104" # render group
- "44" # video group
📚 Références¶
- Intel HD 530 Capabilities
- Recyclarr Configuration
- Jellyfin Transcoding
- Tdarr Documentation
- FFmpeg VAAPI Guide
Dernière mise à jour : 2026-02-13
Auteur : Infrastructure Team
Statut : ✅ Prêt pour implémentation