Files
Audio-Classifier/frontend
Benoit 76d014bda2 Transcodage systématique MP3 128kbps
J'ai implémenté une solution complète pour optimiser ton système audio :
1. Backend - Transcodage & Waveforms
Nouveau module de transcodage (transcoder.py):
Transcodage automatique en MP3 128kbps via FFmpeg
Stockage dans dossier transcoded/
Compression ~70-90% selon format source
Waveforms pré-calculées (waveform_generator.py):
Génération lors du scan (800 points)
Stockage JSON dans dossier waveforms/
Chargement instantané
Schema BDD mis à jour (schema.py):
filepath : fichier original (download)
stream_filepath : MP3 128kbps (streaming)
waveform_filepath : JSON pré-calculé
Scanner amélioré (scanner.py):
Transcode automatiquement chaque fichier
Pré-calcule la waveform
Stocke les 3 chemins en BDD
2. API - Endpoints
Endpoint /api/library/scan (library.py):
POST pour lancer un scan
Tâche en arrière-plan
Statut consultable via GET /api/library/scan/status
Streaming optimisé (audio.py):
Utilise stream_filepath (MP3 128kbps) en priorité
Fallback sur fichier original si absent
Waveform chargée depuis JSON pré-calculé
3. Frontend - Interface
Bouton Rescan (page.tsx):
Dans le header à droite
Icône qui tourne pendant le scan
Affichage progression en temps réel
Reload automatique après scan
4. Base de données
Migration appliquée (20251223_003_add_stream_waveform_paths.py):

ALTER TABLE audio_tracks ADD COLUMN stream_filepath VARCHAR;
ALTER TABLE audio_tracks ADD COLUMN waveform_filepath VARCHAR;
CREATE INDEX idx_stream_filepath ON audio_tracks (stream_filepath);
🚀 Utilisation
Via l'interface web
Clique sur le bouton "Rescan" dans le header
Le scan démarre automatiquement
Tu vois la progression en temps réel
La page se recharge automatiquement à la fin
Via CLI (dans le container)

docker-compose exec backend python -m src.cli.scanner /music
📊 Avantages
 Streaming ultra-rapide : MP3 128kbps = ~70-90% plus léger
 Waveform instantanée : Pré-calculée, pas de latence
 Download qualité : Fichier original préservé
 Rescan facile : Bouton dans l'UI
 Prêt pour serveur distant : Optimisé pour la bande passante
2025-12-23 10:08:16 +01:00
..
2025-12-23 10:08:16 +01:00
2025-12-23 09:40:14 +01:00
2025-12-22 15:53:26 +01:00
2025-12-22 12:59:20 +01:00
2025-12-22 12:59:20 +01:00
2025-11-27 13:54:34 +01:00
2025-12-22 12:59:20 +01:00
2025-12-06 22:22:13 +01:00
2025-11-27 17:43:52 +01:00
2025-11-27 13:54:34 +01:00
2025-11-27 17:43:52 +01:00
2025-11-27 13:54:34 +01:00
2025-11-27 13:54:34 +01:00
2025-11-27 13:54:34 +01:00
2025-11-27 17:43:52 +01:00