High-compression batch tool for images and videos running on local WSL2/Ubuntu. Automatically backs up originals, never overwrites without confirmation.
Images: PNG, JPG, WebP, GIF, BMP, TIFF → WebP (high compression)
Videos: MP4, MOV, AVI, MKV, WMV, FLV, WebM → MP4/H.265 (HEVC) (high compression)
- WSL2 or Ubuntu Linux
- Python 3.11+
- ffmpeg (with libx265)
sudo apt update
sudo apt install -y ffmpegVerify ffmpeg has H.265 support:
ffmpeg -encoders 2>/dev/null | grep hevcpip install -e ".[dev]"mediac compress ./media --level medium --backup ./.compress_backupmediac dry-run ./media --level mediummediac rollback --manifest ./media/.mediac/manifest.dbmediac gui
# Opens at http://127.0.0.1:8765- Scan: Shows file counts and estimated reduction
- Compress: Real-time progress, displays savings
- Rollback: One-click restore from backup
| Level | Image Quality | Video CRF | Use Case |
|---|---|---|---|
| low | 88 | 23 | High quality, larger files |
| medium | 78 | 28 | Balanced (default) |
| high | 65 | 32 | Aggressive, smaller files |
- Automatic backup before any compression
- Atomic replace — original + backup always consistent
- Verification — output checked before replacing
- Rollback support — restore originals anytime
- Images: Multi-core CPU parallel (ProcessPool)
- Videos: Single thread per file (H.265 = CPU-heavy)
- Configurable concurrency
- Final report (text + JSON) with counts & savings
- Per-file logs in
.mediac/logs/ - Manifest DB for re-run skip detection
By default, originals are moved to ./.compress_backup/. If compression fails or you want originals back:
mediac rollback --manifest ./media/.mediac/manifest.dbmediac compress ./media --no-backupWARNING: Without --backup, originals are permanently deleted if compression fails.
mediac compress ./media --forceBy default, files already compressed are skipped.
- WSL2 uses CPU-only encoding (no hardware acceleration)
- Large videos (>1GB) may take 10+ minutes
- Consider splitting very large files first
mediac works on directories only, not individual files.
media/
├── photo.webp (compressed; original in backup)
├── video.mp4 (compressed HEVC)
└── .mediac/
├── manifest.db (state DB for resume/rollback)
├── logs/ (per-run logs)
└── tmp/ (temp files during compression)
.compress_backup/
├── photo.png (original backup)
└── (directory structure preserved)
# Install
sudo apt install -y ffmpeg
# Verify
ffmpeg -version
ffprobe -versionmediac checks before starting and reserves 2GB margin. Free up space and retry.
chmod -R u+w .compress_backup/Normal on WSL2 (CPU-only). Check Task Manager — x265 should be using ~100% CPU.
- scanner.py — Recursively find images/videos by magic bytes (filetype)
- image_compressor.py — Pillow + WebP via ProcessPool
- video_compressor.py — ffmpeg + libx265 via ThreadPool
- dispatcher.py — Parallel job scheduler with graceful exit
- pipeline.py — Orchestrate scan → compress → verify → swap
- manifest.py — SQLite state DB (resume, skip, rollback)
- webapp.py — FastAPI Web UI + SSE progress streaming
- cli.py — typer CLI entrypoint
MIT License — Copyright (c) 2026 TX-220
See LICENSE for details.
TX-220 — Concept, design, direction
Claude (Anthropic) — Implementation
Claude Code & Claude Desktop — Development tooling
Bug reports and pull requests welcome at GitHub.
Q: Does mediac delete originals?
A: No — by default, originals are moved to .compress_backup/. Use --no-backup only if you want them deleted; this disables automatic rollback.
Q: Can I interrupt compression?
A: Yes. Files already completed are recorded in .mediac/manifest.db and skipped on re-run.
Q: What formats does mediac support?
A: Images: PNG, JPG, GIF, BMP, TIFF, WebP → WebP
Videos: MP4, MOV, AVI, MKV, WMV, FLV, WebM → H.265/MP4
Q: Is there a Docker / container version?
A: Not currently — WSL2/Ubuntu native only.