Skip to content

compile (0.26.0): ratio is ignored, and video material duration is set to the item duration (in-point clamped to 0) #133

Description

@fpisasale

Environment: capcut-cli 0.26.0, CapCut desktop 8.7.0 (Windows 11). The skeleton was seeded from the store.

Spec used (trimmed):

{
  "name": "test-compile",
  "ratio": "9:16",
  "tracks": [
    { "type": "video", "items": [
      { "ref": "a", "path": "clip.mp4", "start": 0, "sourceStart": 20, "duration": 6, "scale": 4.7407, "x": 0.3235, "y": -0.1042 },
      { "ref": "b", "path": "clip.mp4", "start": 6, "sourceStart": 40, "duration": 6, "scale": 5.5309, "x": 0.3774, "y": -0.1771 }
    ]},
    { "type": "text", "items": [ { "ref": "t", "start": 0, "duration": 12, "text": "TEST", "fontSize": 12, "color": "#F1B629", "y": -0.45 } ] }
  ]
}

clip.mp4 is a 3840x2160 clip, 89.28 s long.

Bug 1: "ratio": "9:16" is ignored.

  • compile --check reports "canvas":{"width":1920,"height":1080,"ratio":"9:16"}.
  • The written draft has canvas_config = {"width":1920,"height":1080,"ratio":"16:9"}.
  • quickstart --ratio 9:16 gets it right (1080x1920, 9:16).
  • Workaround: "width": 1080, "height": 1920. The dimensions are then correct, but canvas_config.ratio stays "16:9", inherited from the seed draft. We patched it to "9:16" in every timeline copy.

Bug 2: the video material duration is the item duration, not the file duration.

  • Both video materials are written with duration: 6000000, while the file is 89 280 000 µs long.

  • With sourceStart = 20 s and 40 s, every segment reads past the end of its material. capcut-cli's own lint flags it:

    INFO source-range-exceeds-material … reads 40000000us+6000000us of material …, which is only 6000000us long — CapCut clamps an out-of-range in-point to 0

  • So the cuts silently collapse to the start of the file.

  • Expected: material duration = the probed file duration (ffprobe is available, and quickstart probes it correctly: 89.28 s).

  • Workaround: we rewrite each video material's duration with the ffprobe value in every timeline copy, and lint is clean afterwards.

What works well: sourceStart / start / duration produce the right source_timerange and target_timerange; scale, x and y land verbatim in clip.scale and clip.transform; the same media used twice is copied into assets/ only once; the draft is registered in the store index.

— Spirito Digitale

Activity

  1. renezander030 commented on Oct 3, 2026

    @renezander030
    Owner

    Thanks @fpisasale — the reproduction is enough to trace both core defects in the code. A ratio-only spec skips the canvas update, and the segment duration is passed through as the material’s full duration.

    I’m fixing canvas resolution in both --check and compilation, separating full media duration from segment duration (including material registration metadata), and adding coverage for the two six-second cuts at 20 and 40 seconds. Source-range validation will also account for speed before a draft is created. I’ll link the draft PR here when the checks pass.

  2. renezander030 commented on Oct 3, 2026

    @renezander030
    Owner

    Both compile fixes are in draft PR #135: #135

    Ratio-only specs now resolve the canvas for both --check and the written draft. Video/audio material and sidecar durations use the full probed file duration, while your six-second segments retain their 20-second and 40-second in-points. Speed-adjusted source ranges are checked before creating the draft.

    The full local suite passes (1,017 tests), including a probed 89.28-second source and the two reported cuts. Please try your original spec against the PR and confirm the portrait canvas and the intended source moments in the app. The review guide also covers the separate first-open behavior of newly created root-only projects.

  3. renezander030 commented on Oct 3, 2026

    @renezander030
    Owner

    Released in v0.26.1, available on npm:

    npm install -g capcut-cli@0.26.1

    The fresh packaged install was checked with ratio: "9:16" and an 89.28-second source: canvas 1080×1920, full source duration in materials and sidecar registrations, and six-second cuts retaining their 20s/40s in-points. Out-of-bounds speed-adjusted source ranges fail before creating a draft. All 1,017 tests and platform CI passed.

    The verification guide includes the desktop canvas/source-moment check. Please reopen with the spec and output if the released version still reproduces the reported problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions