import-canvas-capture
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseImport Canvas Capture
导入 Canvas Capture
This is an internal, unstable workflow. Keep this skill in ; do
not distribute it through or document the command as a stable API.
.agents/skillspackages/skills这是一个内部且不稳定的 workflow。请将此 skill 保留在 中;不要通过 分发,也不要将该命令记录为稳定的 API。
.agents/skillspackages/skillsWorkflow
工作流
-
Locate the recorded capture file and the target Remotion project. The original recording must contain embeddedmetadata; a converted video that has lost this metadata cannot be imported.
REMOTION_CAPTURE_DATA -
Inspect the project to find the TypeScript file containing its composition registrations (usually). Choose an unused composition ID.
src/Root.tsx -
From the target project's root, run:sh
bunx remotion experimental-codemod add-canvas-capture /absolute/path/capture.webm \ --composition-file src/Root.tsx \ --id MyCaptureWhen developing this command in the monorepo, build the CLI first with, then invoke the local CLI from the target project's root:bun run buildshnode /absolute/path/to/remotion/packages/cli/remotion-cli.js \ experimental-codemod add-canvas-capture /absolute/path/capture.webm \ --composition-file src/Root.tsx --id MyCapture -
Review the reported source files and public asset. The importer generates a component beside the registration file, registers it, copies the video to the public directory, and installs missingand
@remotion/mediadependencies at the project's Remotion version. Studio does not need to be running. Existing Studio sessions pick up source changes through their file watchers; this operation does not enter Studio's undo stack.@remotion/mac-cursors -
Report the composition ID and changed files to the user.
-
找到录制文件和目标 Remotion 项目。原始录制文件必须包含嵌入的metadata;已丢失该 metadata 的转换后视频无法导入。
REMOTION_CAPTURE_DATA -
检查项目,找到包含 composition 注册信息的 TypeScript 文件(通常为)。选择一个未使用的 composition ID。
src/Root.tsx -
从目标项目的根目录运行:sh
bunx remotion experimental-codemod add-canvas-capture /absolute/path/capture.webm \ --composition-file src/Root.tsx \ --id MyCapture在 monorepo 中开发此命令时,请先使用构建 CLI,然后从目标项目的根目录调用本地 CLI:bun run buildshnode /absolute/path/to/remotion/packages/cli/remotion-cli.js \ experimental-codemod add-canvas-capture /absolute/path/capture.webm \ --composition-file src/Root.tsx --id MyCapture -
检查所报告的 source files 和 public asset。导入器会在 registration file 旁生成一个 component 并为其注册,将视频复制到 public 目录,并以项目的 Remotion version 为版本安装缺失的和
@remotion/mediadependencies。Studio 无需运行。现有 Studio sessions 会通过 file watchers 感知 source changes;此操作不会进入 Studio 的 undo stack。@remotion/mac-cursors -
向用户报告 composition ID 和变更后的文件。
Options and conflicts
选项与冲突
- Defaults match Studio's capture import: 1920×1080, 60 fps, and duration rounded
up from the recording. Pass ,
--width, or--heightto override them. Recorded video dimensions remain independent from composition dimensions.--fps - overrides the configured public directory.
--public-dirselects the dependency installer.--package-manager - parses the recording and generates source changes without installing dependencies or writing project files. The programmatic result includes the proposed source changes.
--dry-run - The registration file is resolved relative to the project root; the CLI capture path is resolved relative to the current working directory.
- Existing component files and conflicting public assets are rejected. If the recording is already in the public directory, pass that file as the input to reuse it. Otherwise rename the input or select another composition ID; do not overwrite an existing asset or component to bypass an error.
- 默认值与 Studio 的 capture 导入一致:1920×1080、60 fps,duration 根据录制时长向上取整。可传入 、
--width或--height覆盖这些默认值。录制视频的尺寸与 composition 尺寸彼此独立。--fps - 可覆盖配置的 public 目录。
--public-dir用于选择 dependency installer。--package-manager - 会解析录制文件并生成 source changes,但不会安装 dependencies 或写入项目文件。programmatic result 包含建议的 source changes。
--dry-run - registration file 相对于项目根目录解析;CLI capture path 相对于当前工作目录解析。
- 已存在的 component files 和发生冲突的 public assets 会被拒绝。如果录制文件已位于 public 目录中,请将该文件作为输入传入以复用它。否则,请重命名输入文件或选择另一个 composition ID;不要通过覆盖现有 asset 或 component 来绕过错误。
Programmatic access
程序化访问
Use from . It is internal and
unstable. Its inputs are , , ,
, , , , , , ,
and . Supply for default directory, dimensions, frame rate, and
package manager. File paths are resolved relative to .
CliInternals.importCanvasCapture@remotion/clicaptureFilecompositionFilecompositionIdremotionRootpublicDirfpswidthheightpackageManagerlogLeveldryRunnullremotionRootThe result contains the composition ID, source and asset paths, composition
metadata, and codemod changes. Pass to inspect changes in memory.
dryRun: true使用 中的 。它是内部且不稳定的。其 inputs 包括 、、、、、、、、、 和 。为 default directory、dimensions、frame rate 和 package manager 传入 。文件路径相对于 解析。
@remotion/cliCliInternals.importCanvasCapturecaptureFilecompositionFilecompositionIdremotionRootpublicDirfpswidthheightpackageManagerlogLeveldryRunnullremotionRoot结果包含 composition ID、source path、asset path、composition metadata 和 codemod changes。传入 以在内存中检查变更。
dryRun: true