framefields-cloud
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chineseframefields-cloud
framefields-cloud
The cloud renders the pushed commit of a project on framefields' GPUs and can split a long film across several. Local rendering, checks and named renders in are in ; project setup is in .
framefields.jsonframefields-renderframefields云端使用 framefields 的 GPU 渲染项目中已 push 的 commit,并可将长影片拆分到多个 GPU 上渲染。本地渲染、检查以及 中的 named render 位于 ;项目设置位于 。
framefields.jsonframefields-renderframefieldsMake the project render-ready
让项目达到可渲染状态
The worker clones the repo, installs from the lockfile, fetches assets and calls the render's export. So:
- Commit and push first. Uncommitted changes aren't rendered (the CLI warns); a commit not on the remote, a folder outside git, or a repo without a remote is refused.
- Commit the lockfile and pin . The worker renders with the project's own framefields version (2.11+ for split renders, 2.12+ for named renders). bun lockfiles can't be installed by the worker.
packageManager - Every input must reach the worker: pinned with (preferred), tracked in Git LFS and pushed, or committed. Other
framefields assets addd files don't exist there..gitignore - Build asset paths from , never
import.meta.url. Nothing may write intoprocess.cwd()while rendering.node_modules - Builders stay pure: no rendering, generation or writes while building. runs the same import locally; run it before every cloud render.
npx framefields check <name> - Private repos: the user connects GitHub once at https://framefields.dev/dashboard/settings#connections (the framefields GitHub App, ideally on all repositories). Public repos need nothing.
- Key: it bills the account behind (https://framefields.dev/dashboard/keys), the same key as the AI gateway. Ask the user to set it in the environment; never print, write or embed it.
FRAMEFIELDS_API_KEY
Pinned assets: the CLI and upload any the bucket lacks and sign reads for remotes without a (24 h; keys stay local). Workers download and cache them by hash; R2 downloads are free, unlike LFS bandwidth. Dashboard renders have nobody to sign, so they only read remotes with a .
renderCloudpublicUrlpublicUrlWorker 会 clone repo、根据 lockfile 安装依赖、获取 assets,并调用 render 的 export。因此:
- 先 commit 并 push。 未 commit 的更改不会被渲染(CLI 会发出警告);如果 commit 不在 remote 上、文件夹不在 git 仓库中,或 repo 没有 remote,则会被拒绝。
- 将 lockfile 纳入 commit,并固定 。 Worker 使用项目自身的 framefields 版本进行渲染(拆分渲染需 2.11+,named render 需 2.12+)。Worker 无法安装 bun lockfile。
packageManager - 每个输入都必须能到达 Worker: 使用 固定(推荐)、通过 Git LFS 跟踪并 push,或直接 commit 到 Git 中。其他被
framefields assets add忽略的文件在那里不存在。.gitignore - 使用 构建 asset 路径,绝不要使用
import.meta.url。渲染期间不得向process.cwd()写入任何内容。node_modules - Builder 应保持纯粹: 构建期间不得执行渲染、生成或写入操作。会在本地运行相同的 import;每次云端渲染前都应运行该命令。
npx framefields check <name> - 私有 repo: 用户只需在 https://framefields.dev/dashboard/settings#connections 连接一次 GitHub(使用 framefields GitHub App,最好授予其访问所有 repositories 的权限)。公共 repo 无需任何设置。
- API key: 它会对 (https://framefields.dev/dashboard/keys)所属的账户计费,与 AI gateway 使用同一个 key。应要求用户将其设置在环境变量中;切勿打印、写入或嵌入该密钥。
FRAMEFIELDS_API_KEY
固定 assets:CLI 和 会上传 bucket 中缺少的任何 assets,并为没有 的 remotes 签名读取请求(有效期 24 小时;密钥保留在本地)。Worker 按 hash 下载并缓存这些 assets;R2 下载免费,而 LFS 流量收费。通过 dashboard 发起渲染时没有可用于签名的身份,因此只能读取带有 的 remotes。
renderCloudpublicUrlpublicUrlCLI
CLI
Run from the project folder (where and are; in a monorepo that folder is sent as the workdir).
framefields.jsonpackage.jsonbash
npx framefields render film --cloud --plan # workers, time, estimated cost; renders nothing
npx framefields render film --cloud # render, then download to the render's output
npx framefields render --cloud # the only named render
npx framefields render src/film.ts --cloud --export buildFilm --workers auto # a module, no manifest- Flags override the named render's fields: ,
--workers <n|auto>,--max-workers <n>,--codec h264|vp9,--quality,--select,--output,--export(final status as JSON).--json - defaults to the render's
--workers, else 1.workersmeasures frame cost on one worker, then adds workers only while they stay efficient: a 5-minute film stays on one, a 3-hour film spreads toauto(API cap 10).--max-workers - Show the user before a long or expensive render. It prints e.g.
--planPlan: 4 workers, 1 h 50 min of render work, ready in about 35 min, estimated $1.20. - Output is one line per phase (, rendering N chunks and the audio,
probing,stitching), with progress and cost so far at most every 10 s. Run it in the background and let it finish; Ctrl-C cancels (used GPU time is charged).Done in …: <file>, <GPU seconds>, <cost>.
在项目文件夹中运行(即包含 和 的目录;在 monorepo 中,会将该文件夹作为 workdir 发送)。
framefields.jsonpackage.jsonbash
npx framefields render film --cloud --plan # workers, time, estimated cost; renders nothing
npx framefields render film --cloud # render, then download to the render's output
npx framefields render --cloud # the only named render
npx framefields render src/film.ts --cloud --export buildFilm --workers auto # a module, no manifest- 以下 flags 会覆盖 named render 的对应字段:、
--workers <n|auto>、--max-workers <n>、--codec h264|vp9、--quality、--select、--output、--export(以 JSON 格式返回最终状态)。--json - 默认为 render 的
--workers,否则为 1。workers会先在一个 Worker 上测量帧成本,然后仅在效率仍然合适时增加 Worker:5 分钟的影片保持在 1 个 Worker 上,3 小时的影片会分散到auto(API 上限为 10)。--max-workers - 在耗时较长或成本较高的渲染前,向用户展示 。 它会输出例如
--planPlan: 4 workers, 1 h 50 min of render work, ready in about 35 min, estimated $1.20. - 输出每个阶段占一行(、
probing、rendering N chunks and the audio、stitching),进度和当前成本最多每 10 秒输出一次。让它在后台运行并等待完成;Ctrl-C 会取消任务(已使用的 GPU 时间仍会计费)。Done in …: <file>, <GPU seconds>, <cost>.
From code
从代码调用
No GPU needed locally:
ts
import { CloudRenderError, renderCloud } from "framefields/cloud";
try {
const result = await renderCloud({
render: "film", // or { entry: "src/film.ts", export: "buildFilm", workers: "auto" }
outputPath: "output/film.mp4",
onProgress: (s) => console.log(s.status, s.progress.frames, s.progress.totalFrames, s.costUsd),
// dryRun: true // plan only: result.plan, result.estimateUsd
});
console.log(result.filePath, result.gpuSeconds, result.costUsd);
} catch (err) {
if (err instanceof CloudRenderError) console.error(err.code, err.message);
else throw err;
}Options override the named render's; cancels. exposes , , . HTTP: (, , , , , , , ), / , .
signalcloudClient({ apiKey })startstatuscancelPOST /v1/rendersourcetargetrenderworkersmax_workersdry_runnametitleGETDELETE /v1/render/:idAuthorization: Bearer <key>本地无需 GPU:
ts
import { CloudRenderError, renderCloud } from "framefields/cloud";
try {
const result = await renderCloud({
render: "film", // or { entry: "src/film.ts", export: "buildFilm", workers: "auto" }
outputPath: "output/film.mp4",
onProgress: (s) => console.log(s.status, s.progress.frames, s.progress.totalFrames, s.costUsd),
// dryRun: true // plan only: result.plan, result.estimateUsd
});
console.log(result.filePath, result.gpuSeconds, result.costUsd);
} catch (err) {
if (err instanceof CloudRenderError) console.error(err.code, err.message);
else throw err;
}Options 会覆盖 named render 的对应配置; 可取消任务。 暴露 、 和 。HTTP 接口:(、、、、、、、), / ,。
signalcloudClient({ apiKey })startstatuscancelPOST /v1/rendersourcetargetrenderworkersmax_workersdry_runnametitleGETDELETE /v1/render/:idAuthorization: Bearer <key>Billing and the dashboard
计费与 dashboard
- A credit hold is placed at start (raised to the estimate once planned); the charge is the GPU seconds used, the rest is released. Failed and cancelled renders charge what they used.
- : the user adds funds at https://framefields.dev/dashboard/billing. Don't retry.
insufficient_credits - https://framefields.dev/dashboard/renders shows every render with live progress, cost, Cancel and the video. New render lists the named renders of a connected repo's branch (greyed out when isn't on that branch), with Plan and Render.
entry
- 渲染开始时会预扣一笔 credits(完成规划后调整为估算值);费用按实际使用的 GPU 秒数计算,其余部分会释放。失败和取消的渲染也会按已使用量收费。
- :用户需在 https://framefields.dev/dashboard/billing 充值。不要重试。
insufficient_credits - https://framefields.dev/dashboard/renders 会展示每次 render 的实时进度、成本、Cancel 按钮和视频。New render 会列出已连接 repo 的 branch 上的 named renders(如果该 branch 上不存在 ,则将其置灰),并提供 Plan 和 Render。
entry
Errors
错误
The error carries the worker's code. Fix the project, commit, push, render again.
| Code | Fix |
|---|---|
| Connect GitHub (Settings → Connections) with access to this repo. |
| |
| Commit a lockfile that installs cleanly. |
| Fix |
| The builder throws or renders/writes; |
| |
| |
| Dashboard render of a remote without a working |
| |
| Upgrade framefields (2.11+) or use |
| |
Infrastructure errors (, , a lost worker) are retried by the API, and a straggling chunk gets a backup worker.
GIT_NETWORKRENDER_STALLEDA stitched video with a jump at a chunk seam means a stateful effect reads wall-clock time; keep effects deterministic in the frame number.
错误对象会携带 Worker 返回的代码。修复项目后,commit、push 并再次渲染。
| 代码 | 修复方法 |
|---|---|
| 连接 GitHub(Settings → Connections),并确保其有权访问此 repo。 |
| 执行 |
| 提交一个能够顺利安装的 lockfile。 |
| 修正 |
| Builder 抛出异常,或在构建期间执行渲染/写入; |
| 运行 |
| 在拥有正确文件的机器上运行 |
| 在 dashboard 中渲染一个没有可用 |
| |
| 升级 framefields(2.11+)或使用 |
| 使用 |
基础设施错误(、、Worker 丢失)会由 API 自动重试;如果某个 chunk 滞留,则会为其分配备用 Worker。
GIT_NETWORKRENDER_STALLED如果拼接后的视频在 chunk 接缝处出现跳变,说明某个有状态 effect 读取了 wall-clock time;应确保 effects 根据 frame number 保持确定性。
Self-hosted render worker
自托管 render worker
The same worker runs on your own GPU (Docker, RunPod pod or serverless): it renders a pushed commit with the rules above and uploads the result. A failed job returns ; resubmit unchanged only when is true. Job format: https://framefields.dev/docs/guides/render-service/
{ code, hint, retryable }retryableTo split a render yourself, see Splitting a long render in .
framefields-render同一个 Worker 也可以运行在你自己的 GPU 上(Docker、RunPod pod 或 serverless):它会按照上述规则渲染已 push 的 commit,并上传结果。失败的任务会返回 ;仅当 为 true 时,才可原样重新提交。任务格式:https://framefields.dev/docs/guides/render-service/
{ code, hint, retryable }retryable有关如何自行拆分渲染,请参阅 中的 Splitting a long render。
framefields-render