MediaSync is a fast, local-first pipeline for big photo and video libraries: walk a directory tree, deduplicate with path or content hashing, transcode legacy containers to MP4 (with optional hardware encode on macOS), and export via a staging folder, rclone, or rsync. A terminal UI shows queues, workers, and upload batches; a headless mode fits CI and servers.
Originally built for a WDTV Live Hub workflow, the defaults are now generic so you can point it at any media root.
- Scalable scanning: Persistent per-directory cache (
index.json) skips unchanged folders; bounded queues apply backpressure so memory stays predictable. - Honest dedup:
DEDUP_MODE=pathfor cheap scans, orcontentfor SHA-256 after workers read files (see benchmarks). - Modern video output: Converts common legacy formats and DVD
VIDEO_TSlayouts to MP4; preserves mtimes where possible. - Efficient cloud upload: Batched rclone runs with configurable parallelism cut per-file overhead.
- Rust 1.70+
- ffmpeg and ffprobe on
PATH - rclone (only if
UPLOAD_STRATEGY=rclone) - rsync (only if
UPLOAD_STRATEGY=rsync)
git clone https://github.com/ashesh8500/mediasync.git
cd mediasync
cargo build --release
# binary: target/release/mediasyncOr from a checkout:
cargo install --path .# Scan current directory; TUI (default state dir ~/.mediasync)
mediasync
# One-shot pass, logs only (good for automation)
mediasync --headless true --run-once true
# Custom source and cloud remote (rclone remote name or `remote:path`)
mediasync --src-root /data/media --upload-strategy rclone --gphotos-remote myremote:albums| Variable | Default | Role |
|---|---|---|
SRC_ROOT |
. |
Root to scan |
STATE_DIR |
~/.mediasync |
Cache, upload history, conversion output, spool |
PHOTOS_WATCH |
~/PhotosStaging |
Desktop strategy destination |
UPLOAD_STRATEGY |
desktop |
desktop | rclone | rsync |
GPHOTOS_REMOTE |
gphotos |
rclone destination (remote or name:path) |
RSYNC_DEST_ROOT |
— | Required for rsync strategy |
MAX_WORKERS |
4 |
Photo + direct-video workers |
VIDEO_WORKERS |
2 |
Transcode workers |
DEDUP_MODE |
content |
content (SHA-256) or path |
RCLONE_BATCH_SIZE |
50 |
Files per rclone batch |
HEADLESS |
false |
Disable TUI |
RUN_ONCE |
false |
Exit after one scan + drain |
RETRY_FAILURES |
false |
Retry recent failures (ignores RETRY_AFTER_SEC backoff) |
Full CLI help:
mediasync --helpStreaming SHA-256 (the hot path for DEDUP_MODE=content):
cargo bench -p mediasync --bench hashingOpen target/criterion/report/index.html for Criterion’s HTML report.
- Install the
mediasyncbinary (this crate). - Either copy state:
cp -R ~/.wdtv_sync ~/.mediasync
or setSTATE_DIR=$HOME/.wdtv_syncto keep the old location. - Set
SRC_ROOTif you relied on the old default (/Volumes/WDTVLiveHub).
Historical docs live under archive/.
| Path | Purpose |
|---|---|
src/main.rs |
CLI, TUI, scanner, workers, rclone batch uploader |
src/lib.rs |
Library surface (tests, benchmarks) |
src/hash.rs |
SHA-256 helpers |
benches/hashing.rs |
Criterion benchmarks |
MIT — see LICENSE.
See CONTRIBUTING.md.