From 2ac3cfcf6223e1704ac135511dc4057b863bd56a Mon Sep 17 00:00:00 2001 From: rene Date: Sat, 28 Nov 2026 08:07:25 +0000 Subject: [PATCH] Improve subtitle imports, timeline previews and dubbing --- CHANGELOG.md | 22 +++- README.md | 28 ++--- docs/command-reference.json | 111 +++++++++++++++++- docs/command-reference.md | 2 +- docs/command-reference.zh-CN.md | 2 +- docs/dub-normalization.md | 17 +++ docs/render-color.md | 13 +++ docs/render-range.md | 15 +++ docs/render-webm.md | 13 +++ docs/ripple-captions.md | 23 ++++ docs/spaceless-captions.md | 17 +++ docs/subtitle-input.md | 22 ++++ package-lock.json | 4 +- package.json | 10 +- src/bom.ts | 37 ++++-- src/caption.ts | 89 +++++++++++++-- src/command-specs.ts | 58 +++++++++- src/compile.ts | 3 + src/dub.ts | 13 ++- src/factory.ts | 108 ++++++++++++++---- src/index.ts | 133 ++++++++++++++++++---- src/lint.ts | 24 +++- src/loudness.ts | 67 +++++++++++ src/probe.ts | 49 ++++++++ src/quickstart.ts | 7 +- src/render.ts | 122 +++++++++++++++++--- src/script.ts | 77 +++++++++++-- src/srt.ts | 26 +++-- src/subtitle-markup.ts | 121 ++++++++++++++++++++ test/caption-spaceless.test.mjs | 103 +++++++++++++++++ test/dub-peak.test.mjs | 135 ++++++++++++++++++++++ test/hdr-fidelity.test.mjs | 65 +++++++++++ test/helpers/fake-ffmpeg.mjs | 3 + test/lint-spaceless.test.mjs | 143 +++++++++++++++++++++++ test/render-range.test.mjs | 110 ++++++++++++++++++ test/render-webm.test.mjs | 108 ++++++++++++++++++ test/ripple-captions.test.mjs | 196 ++++++++++++++++++++++++++++++++ test/subtitle-encoding.test.mjs | 84 ++++++++++++++ test/subtitle-markup.test.mjs | 146 ++++++++++++++++++++++++ test/webvtt-import.test.mjs | 4 +- 40 files changed, 2187 insertions(+), 143 deletions(-) create mode 100644 docs/dub-normalization.md create mode 100644 docs/render-color.md create mode 100644 docs/render-range.md create mode 100644 docs/render-webm.md create mode 100644 docs/ripple-captions.md create mode 100644 docs/spaceless-captions.md create mode 100644 docs/subtitle-input.md create mode 100644 src/subtitle-markup.ts create mode 100644 test/caption-spaceless.test.mjs create mode 100644 test/dub-peak.test.mjs create mode 100644 test/hdr-fidelity.test.mjs create mode 100644 test/lint-spaceless.test.mjs create mode 100644 test/render-range.test.mjs create mode 100644 test/render-webm.test.mjs create mode 100644 test/ripple-captions.test.mjs create mode 100644 test/subtitle-encoding.test.mjs create mode 100644 test/subtitle-markup.test.mjs diff --git a/CHANGELOG.md b/CHANGELOG.md index abd7fed..d65b185 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,22 @@ All notable changes to capcut-cli are documented here. The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/); the project follows [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [Unreleased] + +## [0.38.0] - 2026-11-27 + +### Added +- Match synthesized dub clip peaks with explicit `--normalize-peak`, bounded boosts and per-clip gain reports; meter played prefixes before saving and keep dry-run free of TTS/assets. ([pyvideotrans#1251](https://github.com/jianchang512/pyvideotrans/issues/1251)) +- Render selected timeline intervals with `--start`/`--end` on an in-memory draft copy, rebasing video, audio and captions without changing source files. ([Concat#848](https://github.com/jub0t/Concat/issues/848)) +- `remove --ripple --ripple-captions` trims/drops intersecting caption timing and shifts later content while retaining crossing-media and animated-caption safeguards. ([lossless-cut #3209](https://github.com/mifi/lossless-cut/issues/3209)). +- `lint --fix` wraps existing Thai, Lao, Khmer and Myanmar lines at Unicode boundaries while moving editable style ranges with inserted newlines and preserving cue timing. ([OpenCut #924](https://github.com/OpenCut-app/OpenCut/issues/924)). +- Thai, Lao, Khmer and Myanmar captions join without inserted token spaces and split long aligner tokens at Unicode boundaries; estimated internal timings and unresolved caps are reported explicitly. ([OpenCut #924](https://github.com/OpenCut-app/OpenCut/issues/924)). +- WebM proxy outputs select VP9/Opus/WebVTT, refuse incompatible video encoders, and check required encoder availability before rendering; MP4 defaults stay unchanged. ([lossless-cut #3230](https://github.com/mifi/lossless-cut/issues/3230)). +- Proxy fidelity reports known HDR/wide-gamut source metadata and refuses it with `render --strict`; source-color evidence stays explicit when unavailable. ([Concat #858](https://github.com/jub0t/Concat/issues/858)). +- SRT/WebVTT imports map inline bold, italic, underline, and font-color tags to editable ranges across import, quickstart, and compile; escaped tags stay literal, and keyword emphasis preserves inline styling. ([OpenCut #925](https://github.com/OpenCut-app/OpenCut/issues/925), [pyvideotrans #1341](https://github.com/jianchang512/pyvideotrans/issues/1341)). +- Subtitle input honors UTF-16LE/BE byte-order marks, and `import-srt`, `import-ass`, `quickstart`, `detect-retakes` and `dub` accept `--encoding` for an explicitly chosen code page. Strict UTF-8 remains the default for files without a BOM; malformed text and NUL characters are refused before a draft is written ([OpenCut#925](https://github.com/OpenCut-app/OpenCut/issues/925), [subtitleedit#16978](https://github.com/SubtitleEdit/subtitleedit/issues/16978)). +- `README.ja.md`, a Japanese translation of the README, linked from the language selector in all three READMEs and shipped in the npm package. + ## [0.37.1] - 2026-11-23 ### Fixed @@ -39,12 +55,6 @@ All notable changes to capcut-cli are documented here. The format follows [Keep - Portable macOS downloads for Apple Silicon and Intel, with a bundled Node runtime, license and SHA-256 checksum. Both CLI names run without Node or npm on PATH. - Native macOS archive checks before release publication, including relocated paths, bundled-template compilation and runtime-target validation. -## [Unreleased] - -### Added - -- `README.ja.md`, a Japanese translation of the README, linked from the language selector in all three READMEs and shipped in the npm package. - ## [0.34.0] — 2026-11-14 ### Added diff --git a/README.md b/README.md index 6a36332..cbad6ed 100644 --- a/README.md +++ b/README.md @@ -34,16 +34,16 @@ npm install -g capcut-cli ### Portable downloads without installing Node or npm -Download `capcut-cli-v0.37.1-linux-x64.tar.gz` and its `.sha256` file from the [release assets](https://github.com/renezander030/capcut-cli/releases). Verify and extract them together: +Download `capcut-cli-v0.38.0-linux-x64.tar.gz` and its `.sha256` file from the [release assets](https://github.com/renezander030/capcut-cli/releases). Verify and extract them together: ```sh -sha256sum -c capcut-cli-v0.37.1-linux-x64.tar.gz.sha256 -tar -xzf capcut-cli-v0.37.1-linux-x64.tar.gz -./capcut-cli-v0.37.1-linux-x64/capcut --version -./capcut-cli-v0.37.1-linux-x64/capcut describe --compact +sha256sum -c capcut-cli-v0.38.0-linux-x64.tar.gz.sha256 +tar -xzf capcut-cli-v0.38.0-linux-x64.tar.gz +./capcut-cli-v0.38.0-linux-x64/capcut --version +./capcut-cli-v0.38.0-linux-x64/capcut describe --compact ``` -On Linux arm64 (aarch64), choose `capcut-cli-v0.37.1-linux-arm64.tar.gz` and its matching `.sha256` file, then use the same verification and extraction commands with that filename. Use the archive matching the machine architecture; these archives bundle Node, not ffmpeg or the desktop editor. +On Linux arm64 (aarch64), choose `capcut-cli-v0.38.0-linux-arm64.tar.gz` and its matching `.sha256` file, then use the same verification and extraction commands with that filename. Use the archive matching the machine architecture; these archives bundle Node, not ffmpeg or the desktop editor. Keep the whole extracted directory together; it includes the Node runtime and its license. Both `capcut` and `capcut-cli` launchers work after moving the directory. Linux archives target x64 or arm64 with glibc (not Alpine/musl); optional FFmpeg/Whisper tools remain separate. This is a portable directory, not a single-file executable. @@ -52,18 +52,18 @@ You can add the extracted directory to `PATH` or create symbolic links to `capcu On macOS, choose `darwin-arm64` for Apple Silicon or `darwin-x64` for Intel. Download the matching archive and checksum from the same release, then verify and extract them (Apple Silicon example): ```sh -shasum -a 256 -c capcut-cli-v0.37.1-darwin-arm64.tar.gz.sha256 -tar -xzf capcut-cli-v0.37.1-darwin-arm64.tar.gz -./capcut-cli-v0.37.1-darwin-arm64/capcut --version +shasum -a 256 -c capcut-cli-v0.38.0-darwin-arm64.tar.gz.sha256 +tar -xzf capcut-cli-v0.38.0-darwin-arm64.tar.gz +./capcut-cli-v0.38.0-darwin-arm64/capcut --version ``` -On Windows x64 (from release 0.37.1 on), download `capcut-cli-v0.37.1-win-x64.zip` and its `.sha256` file. In PowerShell, compare the hash with the one in the `.sha256` file, extract, and run the `capcut.cmd` launcher: +On Windows x64 (from release 0.37.1 on), download `capcut-cli-v0.38.0-win-x64.zip` and its `.sha256` file. In PowerShell, compare the hash with the one in the `.sha256` file, extract, and run the `capcut.cmd` launcher: ```powershell -(Get-FileHash capcut-cli-v0.37.1-win-x64.zip -Algorithm SHA256).Hash.ToLower() -Get-Content capcut-cli-v0.37.1-win-x64.zip.sha256 -Expand-Archive capcut-cli-v0.37.1-win-x64.zip -DestinationPath . -.\capcut-cli-v0.37.1-win-x64\capcut.cmd --version +(Get-FileHash capcut-cli-v0.38.0-win-x64.zip -Algorithm SHA256).Hash.ToLower() +Get-Content capcut-cli-v0.38.0-win-x64.zip.sha256 +Expand-Archive capcut-cli-v0.38.0-win-x64.zip -DestinationPath . +.\capcut-cli-v0.38.0-win-x64\capcut.cmd --version ``` The folder holds the official Node runtime (`runtime\node.exe` and its license); `capcut.cmd` and `capcut-cli.cmd` work from any location, also with spaces in the path, and you can add the folder to `PATH`. Arguments pass through `cmd.exe`, so quote values containing `&`, `|`, `<`, `>` or `^`. Every release builds this archive on a Windows runner and runs it there before publishing. diff --git a/docs/command-reference.json b/docs/command-reference.json index 269a2c4..2b47ee9 100644 --- a/docs/command-reference.json +++ b/docs/command-reference.json @@ -1,6 +1,6 @@ { "name": "capcut-cli", - "version": "0.37.1", + "version": "0.38.0", "schema_version": 2, "description": "Edit CapCut/JianYing draft_content.json directly. JSON in, JSON out.", "global_flags": [ @@ -1575,6 +1575,35 @@ } ], "options": [ + { + "name": "normalize_peak", + "flags": [ + "--normalize-peak" + ], + "type": "number", + "required": false, + "description": "Normalize each synthesized clip to a true-peak dBFS target (-60 to 0); measures its played prefix with FFmpeg before saving. Use without a separate volume adjustment." + }, + { + "name": "max_gain_db", + "flags": [ + "--max-gain-db" + ], + "type": "number", + "required": false, + "description": "Largest normalization boost in dB; clamped clips report the estimated level actually reached.", + "default": 20 + }, + { + "name": "ffmpeg_cmd", + "flags": [ + "--ffmpeg-cmd" + ], + "type": "string", + "required": false, + "description": "FFmpeg executable for peak normalization.", + "default": "ffmpeg" + }, { "name": "tts_cmd", "flags": [ @@ -1622,6 +1651,15 @@ "description": "Audio track for the clips.", "default": "dub" }, + { + "name": "encoding", + "flags": [ + "--encoding" + ], + "type": "string", + "required": false, + "description": "Subtitle text encoding (for example windows-1252 or shift_jis). UTF BOMs are detected automatically; without a BOM or this option, strict UTF-8 is required." + }, { "name": "ffprobe_cmd", "flags": [ @@ -1849,7 +1887,7 @@ { "name": "remove", "summary": "Remove a segment, its emptied track, and the materials that orphans.", - "usage": "capcut remove [--keep-track] [--keep-materials] [--ripple]", + "usage": "capcut remove [--keep-track] [--keep-materials] [--ripple] [--ripple-captions]", "positionals": [ { "name": "project", @@ -1863,6 +1901,15 @@ } ], "options": [ + { + "name": "ripple_captions", + "flags": [ + "--ripple-captions" + ], + "type": "boolean", + "required": false, + "description": "With --ripple, trim/drop intersecting static caption timing; crossing media remains refused and retained text is unchanged." + }, { "name": "keep_track", "flags": [ @@ -1888,7 +1935,7 @@ ], "type": "boolean", "required": false, - "description": "Close the removed time span across every track; refuses crossing segments." + "description": "Close the removed time span across every track; refuses crossing segments unless caption adjustment is selected." }, { "name": "active_timeline", @@ -3805,6 +3852,15 @@ } ], "options": [ + { + "name": "encoding", + "flags": [ + "--encoding" + ], + "type": "string", + "required": false, + "description": "Subtitle text encoding (for example windows-1252 or shift_jis). UTF BOMs are detected automatically; without a BOM or this option, strict UTF-8 is required." + }, { "name": "track_name", "flags": [ @@ -4157,6 +4213,15 @@ } ], "options": [ + { + "name": "encoding", + "flags": [ + "--encoding" + ], + "type": "string", + "required": false, + "description": "Subtitle text encoding (for example windows-1252 or shift_jis). UTF BOMs are detected automatically; without a BOM or this option, strict UTF-8 is required." + }, { "name": "track_name", "flags": [ @@ -6495,6 +6560,15 @@ } ], "options": [ + { + "name": "encoding", + "flags": [ + "--encoding" + ], + "type": "string", + "required": false, + "description": "Subtitle text encoding (for example windows-1252 or shift_jis). UTF BOMs are detected automatically; without a BOM or this option, strict UTF-8 is required." + }, { "name": "video", "flags": [ @@ -6729,6 +6803,24 @@ } ], "options": [ + { + "name": "start", + "flags": [ + "--start" + ], + "type": "string", + "required": false, + "description": "Start of the preview range (time format; default 0). The source draft is unchanged." + }, + { + "name": "end", + "flags": [ + "--end" + ], + "type": "string", + "required": false, + "description": "End of the preview range (time format; default timeline end). Requires start < end within the timeline." + }, { "name": "out", "flags": [ @@ -6773,7 +6865,7 @@ ], "type": "string", "required": false, - "description": "Video encoder for the proxy (-c:v; default libx264). Hardware encoders like h264_videotoolbox/h264_nvenc/h264_qsv work when the build carries them; validated against `ffmpeg -encoders` before rendering." + "description": "Video encoder for the proxy (-c:v; default libvpx-vp9 for WebM, libx264 otherwise). Hardware encoders like h264_videotoolbox/h264_nvenc/h264_qsv work when the build carries them; validated against `ffmpeg -encoders` before rendering." }, { "name": "crf", @@ -6833,7 +6925,7 @@ ], "type": "boolean", "required": false, - "description": "Mux the text-track cues as a toggleable mov_text subtitle stream (the SRT is also written next to the output as .srt); skipped with a note when ffmpeg has no mov_text encoder." + "description": "Mux text-track cues as toggleable subtitles (WebVTT for WebM, mov_text otherwise); also write .srt. Skipped with a note when the selected subtitle encoder is unavailable." }, { "name": "all_video_tracks", @@ -7220,6 +7312,15 @@ } ], "options": [ + { + "name": "encoding", + "flags": [ + "--encoding" + ], + "type": "string", + "required": false, + "description": "Subtitle text encoding (for example windows-1252 or shift_jis). UTF BOMs are detected automatically; without a BOM or this option, strict UTF-8 is required." + }, { "name": "track_name", "flags": [ diff --git a/docs/command-reference.md b/docs/command-reference.md index 7945fe7..6171266 100644 --- a/docs/command-reference.md +++ b/docs/command-reference.md @@ -32,7 +32,7 @@ | `crop` | `capcut crop [--ratio \| --rect \| --reset]` | yes | Read or set a video/photo segment's source-material crop (--ratio preset, --rect x,y,w,h, or --reset). | | `cut` | `capcut cut --out ` | yes | Extract a time range into a new standalone draft. | | `duplicate` | `capcut duplicate [--track ] [--new-track]` | yes | Duplicate a segment at its same timeline position onto a track above the source. | -| `remove` | `capcut remove [--keep-track] [--keep-materials] [--ripple]` | yes | Remove a segment, its emptied track, and the materials that orphans. | +| `remove` | `capcut remove [--keep-track] [--keep-materials] [--ripple] [--ripple-captions]` | yes | Remove a segment, its emptied track, and the materials that orphans. | | `keyframe` | `capcut keyframe