Personal collection of small utility scripts. This README summarizes what each script does, its requirements, usage, and examples.
- Path:
auto_deint.zsh - Purpose: For interlaced camera footage (e.g.,
.MTS/.m2ts), automatically decide whether to deinterlace, optionally join in‑camera “split” files, and write output with shoot-time metadata suitable for editing/archival. - How it works:
- Uses
ffmpegidetsampling to estimate Progressive vs Interlaced ratio; - When deinterlacing is needed, applies
bwdifwith smart field order selection (TFF/BFF/auto); - Detects adjacent split parts (size near card limit, close timestamps, optional fingerprint match) and concatenates them;
- Writes
Make/Model/creation_timeand can sync output mtime to the shoot time.
- Uses
zshffmpeg/ffprobe(recent versions recommended)- macOS or Linux (handles both BSD/GNU
stat)
./auto_deint.zsh <input_dir> <output_dir>
# Example: process MTS parts in current dir to ./out
./auto_deint.zsh . ./out
- Matches
*.MTS/*.m2tsunder the input directory; default output is./out. - You can pass a higher‑level camera/card directory (e.g.
/Volumes/KESU/DV/TF_.../). The script will auto‑detect a nested.../AVCHD/BDMV/STREAM(case‑insensitive) that contains MTS files. Passing theSTREAMfolder directly still works as before. - Decision logic:
- If Progressive ratio ≥ threshold (default 0.90), keep progressive path;
- Otherwise deinterlace with majority vote or preferred parity.
- Sampling and threshold
FRAMES: number of frames to sample (default1500)PROG_THRESH: progressive ratio threshold 0–1 (default0.90)
- Deinterlace/encoding and audio
PREFERRED_PARITY: preference when TFF/BFF close (tff/bff, defaulttff)VCODEC: encoder:hevc_vt_main|hevc_vt_main10|prores_hq|prores_4444|x264_lossless(defaulthevc_vt_main)VT_QUALITY: VideoToolbox quality 0–100 (default80)AUDIO_COPY: copy audio on progressive path (1/0, default1)PROG_VIDEO_COPY: copy video on progressive path (1=copy,0=re-encode viaVCODEC, default0)
- Split detection and joining
JOIN_SPLITS:auto|off|force(defaultauto)MIN_SPLIT_BYTES: size considered “near limit” (bytes), e.g.2045841408SPLIT_NEAR_PCT: near-limit percentage (0–100, default80)MAX_GAP_SEC: max mtime gap between adjacent parts (seconds, default1200)CHECK_FP: verify video fingerprint (codec/size/fps/field/pixfmt) (1/0, default1)
- Metadata
MAKE/MODEL: camera info written to container and QuickTime tags
- Deinterlace and export using ProRes HQ to a specific directory:
VCODEC=prores_hq ./auto_deint.zsh /Volumes/CAMCARD/DCIM ./out
- Stricter progressive threshold, force join splits, do not copy audio:
PROG_THRESH=0.95 JOIN_SPLITS=force AUDIO_COPY=0 ./auto_deint.zsh . ./out
- Path:
jellyfin_linker.py - Purpose: Symlink completed files from a downloader folder (default
Transmission) into a siblingJellyfinfolder so your media server can index them. Uses a manifest to avoid duplicate links across runs.
- Recursively scans
Transmission, ignoring files ending with.part; - Filters tiny video files by size threshold (default skip <
1 MiB; set--min-video-size 0to disable); - Two linking modes:
--mirror(default): preserve subfolder structure insideJellyfin;--flatten: place all links inJellyfinroot; name collisions auto-suffixed with(1),(2), ...;
- Records processed sources in
Jellyfin/.link-manifest.jsonto avoid reprocessing; - Scans and removes broken symlinks in
Jellyfinat the end.
- Python 3.8+
- A filesystem that supports symlinks
- By default the script’s directory is the base containing:
Transmission/Jellyfin/
- Use
-C/--workdirto pick another base; or override names with--transmission-name/--jellyfin-name.
# Mirror structure (default)
python3 jellyfin_linker.py
# Flatten into Jellyfin root
python3 jellyfin_linker.py --flatten
# Specify working directory
python3 jellyfin_linker.py -C /data/media
# Dry run
python3 jellyfin_linker.py --dry-run
# Ignore manifest and relink everything
python3 jellyfin_linker.py --force
# Adjust minimum video size (MiB)
python3 jellyfin_linker.py --min-video-size 5
- Prints a summary of created/skipped/collisions/cleanup so you can verify batch results.
- Platform: written and verified on macOS; works on Linux as well (mind
ffmpeg/statdifferences). - Tip: start with
--dry-runor a small sample before batch runs. - Contributions: PRs/issues welcome; inline comments and improvements are appreciated.