Docker container that watches a directory for FLAC files and automatically converts them to MP3 (320k CBR). Unraid-friendly.
- Shell 67.3%
- Dockerfile 32.7%
- Abschnitt 'Mitwirkende' vor Lizenz eingefügt - Verlinkung auf DasAoD und Claude (Forgejo) Co-authored-by: Claude <claude@anthropic.com> |
||
|---|---|---|
| .gitignore | ||
| Dockerfile | ||
| flac2mp3-icon-v3-256.png | ||
| LICENSE | ||
| README.md | ||
| watcher.sh | ||
flac2mp3-watcher
A lightweight Docker container that watches a directory tree for FLAC files and automatically converts them to MP3 (320k CBR) in-place. The source FLAC file is deleted after a successful conversion.
Built on Alpine Linux with ffmpeg and inotify-tools. Unraid-friendly (runs as UID 99 / GID 100).
Docker Hub: dasaod/flac2mp3
Features
- Watches recursively via
inotify— reacts immediately, no polling - Converts FLAC → MP3 at 320k CBR, preserving metadata tags
- Deletes the original FLAC after a successful conversion
- Initial scan on startup (converts any existing FLAC files)
- Skips files where an up-to-date MP3 already exists
- Log rotation (configurable size and number of backups)
- Healthcheck: verifies
inotifywaitis running - Unraid-friendly: runs as
nobody:users(99:100), respects umask
Quick Start
docker run -d \
--name flac2mp3-watcher \
-e ROOT=/media \
-v /path/to/your/music:/media \
-v /path/to/appdata/flac2mp3:/config \
dasaod/flac2mp3:latest
Environment Variables
| Variable | Default | Description |
|---|---|---|
ROOT |
/media |
Directory to watch (must be mounted) |
UMASK_VAL |
002 |
File creation umask |
LOGFILE |
/config/flac2mp3-watcher.log |
Log file path |
LOG_MAX_MB |
10 |
Max log size in MB before rotation |
LOG_BACKUPS |
3 |
Number of rotated log files to keep |
Volumes
| Container path | Purpose |
|---|---|
/media |
Music directory to watch (mount your FLAC folder here) |
/config |
Log file storage |
Unraid Template
Repository: dasaod/flac2mp3:latest
Network: Bridge
Volumes:
/path/to/music → /media (RW)
/mnt/user/appdata/flac2mp3 → /config (RW)
Environment:
ROOT = /media
UMASK_VAL = 002
LOGFILE = /config/flac2mp3-watcher.log
LOG_MAX_MB = 10
LOG_BACKUPS = 3
Build
# Build locally
docker build -t dasaod/flac2mp3:1.2 -t dasaod/flac2mp3:latest .
# Push to Docker Hub
docker push dasaod/flac2mp3:1.2
docker push dasaod/flac2mp3:latest
How It Works
- On startup, an initial scan converts all existing
.flacfiles underROOT inotifywaitthen watches for new or updated files (CLOSE_WRITE,CREATE,MOVED_TO)- When a
.flacfile is detected,ffmpegconverts it to.mp3(320k CBR) in the same directory - On success, the original
.flacis deleted - Log rotation runs automatically when the log exceeds
LOG_MAX_MB
Changelog
1.2
- Fix: log rotation now called on every log entry
- Fix: relative paths from inotify always resolved to absolute
- Improved: case-insensitive FLAC extension matching via
nocasematch
1.1
- Added log rotation (
LOG_MAX_MB,LOG_BACKUPS) - Added Dockerfile with embedded
watcher.sh(no install on start) - Added Healthcheck
- Improved path handling
1.0
- Initial release
Mitwirkende
Dieses Projekt wurde in Zusammenarbeit mit Claude (Sonnet 4.6) von Anthropic entwickelt und iterativ ausgebaut.
Der überwiegende Teil des Codes, der Architektur und der Dokumentation wurde durch KI generiert und gemeinsam verfeinert.
| Rolle | Person / Tool |
|---|---|
| Projektidee, Anforderungen & Tests | DasAoD |
| Code, Architektur, Dokumentation | Claude (Anthropic) |