English | 简体中文
Windows batch transcoder for camera archives. It preserves Sony and DJI metadata, repairs multi-channel audio timing, supports hardware scaling, and can verify or repair existing deliverables.
- Windows 10/11 x64.
- Python 3.11+.
numpy/scipyfor channel sync and audio analysis.- NVIDIA NVENC, Intel QSV, or software x265 / SVT-AV1.
- A self-contained package includes FFmpeg, NVEncC, QSVEncC and GPAC.
For a short command summary run python 1kt.py --help; every option and
default is listed by python 1kt.py --help-all.
python 1kt.py --input D:\footage --output D:\archive --preset hq
python 1kt.py --input D:\footage --output D:\archive --encoder nvenc
python 1kt.py --input D:\footage --output D:\archive --encoder qsv --preset uhqWithout --encoder, the backend is selected in order: NVENC -> QSV -> x265.
Hardware backends never fall back to software encoding.
start.bat starts a drop-folder watcher: put video files in watch_input\,
and each file is encoded (or losslessly remuxed) once its size and mtime have
been unchanged for a while; the source then moves to watch_processed\
(success) or watch_failed\ (failure). All behaviour lives in one JSON file,
configs/watchfolder.json; see the watch folder guide
for the schema, stability/staging semantics, failure handling and tests.
start.bat # foreground watcher; Ctrl+C stops it
start.bat --once --dry-run # one scan, stage + print only
python tests\watchfolder\test_watchfolder.py| Input | Handling |
|---|---|
Sony XAVC (rtmd) |
Preserves rtmd, nrtm and vendor uuid boxes |
DJI Action (djmd/dbgi/tmcd) |
Preserves motion and timing metadata |
| DJI Pocket / drones | Metadata off by default; use --preserve-metadata |
| Other camera files | Standard transcode |
| Backend | Codec |
|---|---|
nvenc, nvenc-av1 |
HEVC / AV1 via NVEncC |
qsv, qsv-av1 |
HEVC / AV1 via QSVEncC |
x265, svtav1 |
Software HEVC / AV1 |
Presets: uhq, hq, small, fast.
DJI Action cameras split long recordings near 16 GB. --dji-join (off by
default) detects contiguous segments and joins them losslessly in one MP4Box
pass (-unalign-cat keeps exact CFR video; djmd/dbgi/tmcd preserved),
then runs the normal pipeline on the joined source.
python 1kt.py --input D:\footage --output D:\archive --dji-join
python 1kt.py ... --dji-join --dry-run # detect groups onlyJoining is progressive: the first group is joined before encoding starts, each
next group is joined in the background while the previous one is encoding, and
a delivered group's joined source is deleted immediately. Peak disk use is the
current group plus the next one, not every group at once. -flat makes
MP4Box write directly to the destination (no full-size temp file), so a 60 GB
joined group costs ~60 GB, not ~120-180 GB. Staging lives under
<output>/.dji_join_work_*; the tree is removed after a fully successful run
and kept on failure or with --dji-join-keep-temp (which also keeps every
joined group, so plan for the full sum). See
DJI split recordings.
--remux is the lossless container path: it always rebuilds the container
and drops padding (Sony cameras allocate each clip's media data in 128 MiB
chunks; a short clip leaves unused tail space inside mdat), while video,
audio and metadata tracks are stream-copied — no video encode. Since v0.9.24
the old --channel-sync-transparent switch is gone: its capability is merged
into --remux --channel-sync, and the old "everything already aligned ->
byte-identical source copy" behaviour no longer exists (--remux always
rebuilds the container).
Sony XAVC:
python 1kt.py --input "D:\SonyClips" --output "D:\SonyClips_remux" --remux
python 1kt.py ... --remux --channel-sync # + optional audio alignment- Video /
rtmddata track are copied bit-for-bit; audio tracks are copied bit-for-bit too unless--channel-syncreplaced them; nrtm, Lens profile, vendoruuid,tref/cdscand XAVC brands are restored bypreservation/fast_restore.py(in-place rebuild first, one-pass copy fallback; the old multi-pass GPAC restore chain is no longer used);--channel-syncis optional: when the multi-track PCM layout is eligible, fixed tracks are re-encoded from shifted audio and untouched tracks are stream-copied.already_aligned/not_eligible/measure_failedand friends are a no-op for audio — the container is still rebuilt;- validation follows
--check(basic/advanced/full); full adds Gyroflow + detailed selfcheck; PSNR/SSIM isSKIPPED_NOT_APPLICABLEbecause the video is stream-copied; - XML sidecars are copied; non-Sony files are rejected unless the generic branch below applies.
DJI (split recordings and single files):
python 1kt.py --input "D:\DJI" --output "D:\DJI_remux" --remux
python 1kt.py ... --remux --dji-join # join split groups first
python 1kt.py ... --remux --dji-join --channel-sync- DJI sources are detected automatically (
djmd/dbgi/tmcd); no--dji-joinis needed to remux an ungrouped DJI file; - with
--dji-join, split groups are joined losslessly first; - each joined file (and each ungrouped DJI file) is rebuilt as a fresh
container with video/
djmd/dbgi/tmcdcopied bit-for-bit (audio too, unless channel-sync replaced it); - DJI Action audio is usually AAC 2ch: channel-sync reports
not_eligibleand automatically no-ops, then the file is remuxed as usual — that is a normal outcome, not a failure; - validation follows
--check(basic/advanced/full); full quality metrics are reported as not applicable because the video is stream-copied; - XML sidecars are copied and joined-sidecar names follow the joined output.
Generic MP4/MOV (non-Sony/DJI):
python 1kt.py --input "D:\OtherCam" --output "D:\OtherCam_remux" --remux --channel-sync- enabled only with both flags; plain
--remuxstill rejects non-Sony/DJI files; - the container is rebuilt with native track copy, and
--channel-syncapplies only when the audio layout is eligible (otherwise it no-ops); - validation is a fixed hard check (frame count/fps, video packet payload must
stay bit-identical, audio stream signature unchanged; audio payload must also
stay bit-identical unless alignment replaced it) and does not vary with
--check; --no-metadatais ignored for generic sources: every non-audio/video track (data/subtitles/timecode) is preserved.
All remux paths honor --jobs (auto uses the same adaptive scheduler as the
main pipeline; N sets the number of concurrent remux jobs). Channel-sync
audio measurement is globally serialized (one file at a time, with its own
estimator pool inside), so --jobs never multiplies audio analysis.
Validation is asynchronous with one verifier slot: waiting for --check does
not consume a remux job slot. --no-metadata strips metadata
(rtmd/nrtm/vendor uuid/tref/XAVC brand; DJI djmd/dbgi/tmcd),
does not copy XML sidecars, and validates the resulting video+audio container
with container/frame checks. It combines with --channel-sync: audio alignment
runs first, then metadata/data tracks are stripped. A failed validation
removes the artifact and retries the remux once; a second failure marks the
file failed. --remux --audio-plan is rejected, and --keep-work keeps
<output>/.1ktwork/<job_id>/ for successful remuxes. With --channel-sync,
each file's remux report (<output>/logs/remux_reports/<stem>.json) carries a
channel_sync block (status / per-track decisions / long_take path when the
time-varying fallback fired).
Measured on 53 Sony clips: 19.67 GB -> 17.88 GB, 1.79 GB saved (9.09%), per-file savings 1.4%–40.2%.
- Default output is 10-bit, regardless of source depth; use
--output-depth {8,10,12}to override. - Chroma follows the source (4:2:0 / 4:2:2 / 4:4:4) where the backend supports
it;
--output-chroma {420,422,444}overrides explicitly. - NVENC HEVC supports true 4:4:4 output; QSV/AV1 reject unsupported manual chroma loudly.
- mono is not supported (source or output); it fails with a clear error.
--resize WxH: exact output resolution (even dimensions); does not preserve the source aspect ratio.--scale FACTOR: multiplies the long edge and preserves the source aspect ratio (0.5,0.25,2, ...); output dimensions are rounded to even values.--resize-algo:bilinear,bicubic,lanczos; default lanczos.--resizeand--scaleare mutually exclusive. Without either option the output resolution is unchanged.- NVENC:
--vpp-resizewith--output-res. - QSV: same plus
--vpp-resize-mode quality. - x265 / SVT-AV1 default to hardware decode and scale in that path through
scale_cudaorvpp_qsv; FFmpeg CPU scaling is the fallback when hardware decode is unavailable. --repairand--remuxreject both options.
python 1kt.py ... --encoder nvenc --scale 0.5 # 4K -> 1080p
python 1kt.py ... --encoder qsv --scale 2 # 1080p -> 4K
python 1kt.py ... --encoder x265 --resize 1920x1080- 3–8 independent PCM channels are aligned automatically (48/96 kHz).
- Long takes use time-varying alignment when the delay is not constant.
- In
--remuxmode audio alignment is opt-in: use--remux --channel-sync(see Lossless remux above);--remuxalone only rebuilds the container. --audio-plan JSONselects, maps, orders, aligns and encodes audio.- Compressed audio and mixed PCM/compressed files require an explicit plan.
python 1kt.py ... --check basic
python 1kt.py ... --check advanced
python 1kt.py ... --check full
python 1kt.py --input D:\deliverables --output D:\fixed --repairbasic checks core metadata and stream facts; advanced adds full structural
and Gyroflow checks; full adds detailed self-checks and a PSNR/SSIM sample.
Batches are resumable. Failed files are written to
<output>/logs/failed_files.json for retry with --retry-list.
Runtime logs (including per-file logs and the dashboard JSON) live under
<output>/logs/, so each output directory is self-contained; the temporary
NVENC/QSV raw encoder logs live in <output>/.1ktwork/<job>/ and are removed
on success.
python tests\full_autotest.py --level unit
python tests\full_autotest.py --level toolchain
python tests\full_autotest.py --level fullReal-feature tests require testsets/ and F:\Pictures\2026; without them,
environment-only checks report FAIL.
- Release notes v0.9.24 (prerelease)
- Release notes v0.9.23
- Release notes v0.9.22
- Release notes v0.9.21
- Release notes v0.9.20
- Release notes v0.9.19
- Release notes v0.9.18
- Release notes v0.9.17
- Release notes v0.9.16
- Release notes v0.9.15
- Release notes v0.9.14
- Release notes v0.9.12
- DJI Action split recordings
- Watch folder guide (unattended drop folder)
- v0.9.24 verification report (detailed testing process)
- v0.9.24 encoding-speed benchmark (hardware decode/conversion)
- v0.9.24 long-test charts (4K/1080p speed heatmaps)
- Hardware scaling validation
- Hardware scaling feasibility
- Audio plan guide
- x265 profile design
- Hardware decode
- 4K encoder evaluation archive (2026-11-16, hardware + x265 / SVT-AV1)