Summary
addVideo (and likely addAudio) in src/factory.ts copies source files into
assets/video/<basename> using only the file's basename, and skips the copy
if the destination already exists:
const filename = basename(opts.path) || "media";
const destPath = resolve(assetsDir, filename);
if (!existsSync(destPath)) {
copyFileSync(opts.path, destPath);
}
If two different source files share the same basename (e.g. en/0_00.png
and jp/0_00.png), the second one added is silently skipped — the draft
ends up pointing at the wrong file's content, with no error or warning.
Expected behavior
I understand the reasoning behind skipping the copy when the destination
already exists (avoids redundant copies). But when the skip happens because
of a different source file resolving to the same destination filename,
the CLI should print a warning to the console, e.g.:
Warning: "assets/video/0_00.png" already exists from a different source
file; skipping copy. The draft may reference stale content.
This would make the collision visible instead of silently producing a
draft with the wrong media.
Repro
capcut add-video <project> path/to/jp/0_00.png 0s 7s
capcut add-video <project> path/to/en/0_00.png 0s 7s
- The second segment's material ends up pointing at the jp image content,
with no warning printed.
Summary
addVideo(and likelyaddAudio) insrc/factory.tscopies source files intoassets/video/<basename>using only the file's basename, and skips the copyif the destination already exists:
If two different source files share the same basename (e.g.
en/0_00.pngand
jp/0_00.png), the second one added is silently skipped — the draftends up pointing at the wrong file's content, with no error or warning.
Expected behavior
I understand the reasoning behind skipping the copy when the destination
already exists (avoids redundant copies). But when the skip happens because
of a different source file resolving to the same destination filename,
the CLI should print a warning to the console, e.g.:
This would make the collision visible instead of silently producing a
draft with the wrong media.
Repro
capcut add-video <project> path/to/jp/0_00.png 0s 7scapcut add-video <project> path/to/en/0_00.png 0s 7swith no warning printed.