A Docker container that watches an input folder for new video files and automatically processes them using ffmpeg — stripping unwanted audio/subtitle tracks, removing metadata, and optionally normalizing audio. Processed files are written to an output folder; all actions are logged with timestamps.
# 1. Create local folders
mkdir -p input output logs
# 2. Build and start
docker compose up -d --build
# 3. Drop a video in — processing starts automatically
cp my_movie.mkv input/
# 4. Follow the log
tail -f logs/video-cleanup.log- A Python watchdog monitors
/inputfor new or moved video files - Waits until the file size has been stable for
STABLE_SECSseconds (safe for slow network copies) - Calls
video_cleanup.shwith the file as argument - The script writes the result to
/output— the original in/inputis never touched (unlessKEEP_BACKUP=false, in which case it is removed after successful processing) - Every action is appended with a timestamp to
/logs/video-cleanup.log
.
├── Dockerfile
├── docker-compose.yml
├── README.md
├── video_cleanup.sh # ffmpeg processing logic
└── watchdog_processor.py # folder watcher
# runtime:
├── input/ ← drop videos here
├── output/ ← processed files appear here
└── logs/
└── video-cleanup.log
| Variable | Default | Description |
|---|---|---|
KEEP_LANGS |
deu ger de |
Language codes to keep (space-separated) |
CLEANUP |
true |
Remove audio/subtitle tracks not in KEEP_LANGS |
REMOVE_ALL_SUBS |
false |
Strip all subtitle tracks (including kept languages) |
REMOVE_METADATA |
false |
Remove all metadata/tags from the container |
NORMALIZE |
false |
loudnorm 2-pass audio normalization (→ AAC 192k stereo) |
KEEP_BACKUP |
false |
Keep original as .bak in the input folder |
EXTENSIONS |
mkv mp4 avi ts m2ts mov |
Space-separated list of monitored file extensions |
Edit KEEP_LANGS in docker-compose.yml:
# English only
KEEP_LANGS: "eng en"
# German + English
KEEP_LANGS: "deu ger de eng en"
# Japanese only
KEEP_LANGS: "jpn ja"CLEANUP: "true"
KEEP_LANGS: "deu ger de"
REMOVE_ALL_SUBS: "false"
REMOVE_METADATA: "false"
NORMALIZE: "false"CLEANUP: "true"
KEEP_LANGS: "eng en"
REMOVE_ALL_SUBS: "true"
REMOVE_METADATA: "true"
NORMALIZE: "true"2025-03-15 14:23:01 [INFO] New file detected: /input/movie.mkv
2025-03-15 14:23:06 [INFO] Processing: /input/movie.mkv
2025-03-15 14:23:06 [INFO] Keep languages : deu ger de
2025-03-15 14:23:06 [INFO] Audio tracks: 3 | Subtitles: 2
2025-03-15 14:23:06 [INFO] Audio #1: lang=deu ✔ keep
2025-03-15 14:23:06 [INFO] Audio #2: lang=eng ✘ remove
2025-03-15 14:23:06 [INFO] Audio #3: lang=und ✘ remove
2025-03-15 14:23:06 [INFO] → Starting cleanup...
2025-03-15 14:23:44 [INFO] ✔ Cleaned → /output/movie.mkv
2025-03-15 14:23:45 [INFO] ✔ Successfully processed: /input/movie.mkv
- Docker Engine 24+ with Compose v2
- The container ships with
ffmpegfrom the Debian package repos.