---
name: "capcut-edit"
description: "Edit a CapCut desktop project by writing directly to its project JSON. Use when asked to cut, zoom, color-grade, add music or restructure a CapCut timeline."
---

# Editing a CapCut project directly

CapCut stores each project as JSON on disk. Editing that JSON is faster and more precise
than driving the UI, and the result is a real project the user can still open and change
by hand before exporting.

This needs the CapCut **desktop** app. The browser version keeps no project files locally,
so there is nothing to edit.

## Hard rules

1. **Never open CapCut and never use computer use for this.** All work is file edits.
2. **CapCut must be fully quit before editing.** It holds the project in memory and
   overwrites the file on save, silently discarding everything written underneath it.
   Check it is not running before the first write; if it is, stop and ask the user to quit it.
3. **Copy the whole project folder before the first write.** Name the copy
   `<project>__backup_<YYYY-MM-DD-HHMM>` beside the original, once per session, and tell
   the user where it is. The `.bak` file CapCut keeps is overwritten by CapCut itself, so
   it is not a substitute.
4. **Never retype JSON from tool output.** Tool results truncate. Load, mutate and dump
   with a script that opens the file itself.
5. **Validate before finishing.** Re-parse the written JSON and confirm the top-level
   `duration` matches the furthest `target_timerange` end across all tracks.

## Finding the projects folder

| OS | Path |
|---|---|
| macOS | `~/Movies/CapCut/User Data/Projects/com.lveditor.draft` |
| Windows | `%LocalAppData%\CapCut\User Data\Projects\com.lveditor.draft` |
| Windows, Microsoft Store install | under `%LocalAppData%\Packages\<PackageName>\...` |

Confirm the folder exists rather than assuming the layout. Project folders are named by
the user, often as a date like `1025`. If the named project is not there, list the folder
by modification time and ask which one.

Both this folder and the folder holding the raw footage need to be shared with the
session, or media paths will not resolve.

## The files that matter

| File | What it holds |
|---|---|
| `draft_info.json` *or* `draft_content.json` | The timeline: tracks, segments, materials, effects. This is what you edit. |
| `draft_meta_info.json` | The media registry - every source file the project references. |
| `*.bak`, `template-*.tmp` | CapCut's own copies. Do not edit. |

The timeline file is named differently across versions. **Check which one exists** instead
of assuming: older guides name `draft_content.json`, recent builds write `draft_info.json`.

## Structure of the timeline file

The shape below was read from a real recent project. Field names move between versions, so
read the actual file before editing and treat anything missing as a version difference
rather than an error.

**All times are in microseconds.** 1 second = 1_000_000. A 128.43-second project has
`duration: 128433333`.

Top level carries `duration`, `fps`, `canvas_config` (`width`, `height`, `ratio`),
`tracks` and `materials`.

`tracks` is a list. Each track has a `type` (`video`, `audio`, `text`, `effect`) and a list
of `segments`. Tracks render in list order; a track with zero segments is normal and
usually a placeholder.

Each segment carries:

- `id` - the segment's own UUID
- `material_id` - the entry in `materials` it plays
- `extra_material_refs` - UUIDs of attached speed, volume, canvas, animation and filter
  materials. Every one must exist in `materials` or CapCut reports the project as corrupt.
- `target_timerange` - `{start, duration}` on the timeline
- `source_timerange` - `{start, duration}` within the source clip
- `speed`, `volume`, `visible`, `render_index`
- `clip` - `{scale: {x, y}, rotation, transform: {x, y}, flip, alpha}`
- `common_keyframes` - animated properties over time

`materials` is a dict of lists keyed by kind: `videos`, `audios`, `texts`, `effects`,
`video_effects`, `transitions`, `speeds`, `canvases` and many more. A video material carries
`id`, `type`, `path` (absolute), `material_name`, `duration`, `width`, `height`, `has_audio`.

## Common edits

**A cut** - split one segment into two: copy it, give the copy a fresh UUID, then set the
first segment's `target_timerange.duration` and the second's `target_timerange.start` and
`source_timerange.start`. Keep `source_timerange` consistent with `target_timerange` or the
clip drifts out of sync with its own audio.

**Removing a span** - delete or shorten the segments inside it, then shift every later
segment's `target_timerange.start` back by the same amount, **on every track**. Forgetting
a track is the usual cause of audio sliding out of sync.

**A zoom** - add two `common_keyframes` entries on the segment's `clip.scale`, at the start
and end of the move. Slow and small reads better than fast and large: 1.0 to 1.08 over two
seconds.

**Adding media** - register it in BOTH places: a new entry in the right `materials` list
with an absolute `path`, and a matching entry under `draft_materials` in
`draft_meta_info.json`. A file registered in only one place loads as an offline clip.

## When the structure for something is unknown

For anything not described above - an adjustment layer, a specific transition, a text style
- do not guess the schema. Ask the user to do that one thing by hand in CapCut on a scratch
project, quit CapCut, then diff the timeline file against a copy taken beforehand. The diff
shows exactly which materials and fields CapCut writes for that feature. This is also how
to recover when a version differs from what is written here.

## Finishing

Tell the user which project was changed, what changed in it, and where the backup is. They
reopen CapCut themselves - the timeline is there, and every cut is still editable.