Make videos on the computer you already own. FreeVideo runs MiniMax H3 in as little as 8 GB of VRAM and 16 GB of RAM, and adapts its acceleration path to your hardware.
Guide reference images and longer videos in the creation panel
Bowen Xue8c559317d4d3
diff --git "a/docs/zh-CN/\344\275\277\347\224\250\350\257\264\346\230\216.md" "b/docs/zh-CN/\344\275\277\347\224\250\350\257\264\346\230\216.md"new file mode 100644index 0000000..3e00fb3--- /dev/null+++ "b/docs/zh-CN/\344\275\277\347\224\250\350\257\264\346\230\216.md"@@ -0,0 +1,53 @@+# 使用说明++这一页说明创作面板里三件常被问到的事:用参考图生成视频、首帧尾帧和参考图的区别、做更长的视频。++## 参考图生成视频++1. 打开创作面板,展开“素材”。+2. 点“添加”,选择图片。上传的每张图片可以指定用途:首帧、尾帧或参考。要让画面里出现这张图里的人物、物品或场景,选“参考”。+3. 在描述里输入 `@`,从列表里选一张素材,描述里会出现 `<Picture 1>` 这样的标记。视频和音频素材对应 `<Video 1>`、`<Audio 1>`,各类素材分别编号。+4. 在描述里说明这张图在画面中的角色,例如“`<Picture 1>` 里的女孩在海边奔跑”,然后点“生成视频”。++素材可以暂时关闭而不删除:取消勾选的素材不参与这次生成,其余素材的编号会随之重排,描述里的标记会同步更新。++参考图生成视频目前仍是实验能力。能够运行不等于每次都能保持人物外观一致,画面不满意时可以换一张更清晰的正面图再试。++## 首帧、尾帧和参考的区别++| 用途 | 作用 | 适合 |+| --- | --- | --- |+| 首帧 | 视频从这张图开始 | 让一张画好的图动起来 |+| 尾帧 | 视频在这张图结束 | 指定结束时的画面,可以只给尾帧 |+| 参考 | 图里的内容出现在视频中,但不规定哪一帧 | 保持人物、物品、场景的样子 |++- 首帧和尾帧可以同时使用。+- 首帧、尾帧与参考暂时不能混用。同时给了两类,先保留其中一类。+- 首帧和尾帧会按输出画幅居中裁切;参考图保持原有比例,按输出像素面积缩小。++## 在描述里用 @ 引用素材++- 输入 `@` 后会列出当前可用的素材,选中后插入对应的标记。+- 也可以直接写标记,如 `<Picture 2>`、`<Video 1>`、`<Audio 1>`。+- 编号顺序是:先是上传的素材,再是从上到下连接的图片,最后是音频。参考视频的声音也占一个音频编号。+- 删除或关闭某张素材后,描述里指向它的标记会改成“[素材已移除]”,其余标记按新编号更新。++## 做更长的视频++有三种做法,可以单独用,也可以搭配。++1. **直接把时长填长。** 超过一次能生成的长度时,FreeVideo 自动分成几段依次生成,再接成一条视频。+2. **接着生成。** 在生成好的视频结果卡上点“接着生成”,继续下一段;也可以到“剪辑视图”里逐段修改。适合边看边调。+3. **用 AI 全自动。** 打开“AI 全自动”,把想法交给 Agent,它会按镜头拆分、逐镜生成并拼接。耗时随镜头数和每镜时长而定,每镜按普通生成计时。++### 在剪辑视图里加参考图++在剪辑视图里延长时,选中那一段,点生成条描述框旁的“+ 参考图”,上传或生成图片。接续段最多用 3 张参考图,和创作面板共用同一份素材。剪辑视图里只能加图片,参考视频和音频要在创作面板的“素材”里添加。++### 限制++- 两种做法一样,一条视频最多 5 段(第一段加 4 次接着生成),所以创作面板里时长最多填 60 秒。接续的每一段至少 10 秒,整条约 70 秒。剪辑视图里逐段生成同样适用。接得越多,衔接处越容易出现变化,能切镜头的地方建议直接切镜头,用对应的参考图开始新的一段。+- 接着生成使用轻量档,需要 NVIDIA 显卡,也不能和“继续二采”同时使用。+- 单次生成的最长时长随画幅和显卡而不同,在创作面板的“范围”里可以查看每种尺寸能生成多长、大约需要多久。+- 分段生成同样需要 NVIDIA 显卡,Mac 上不支持。+- 分段生成过程中取消,只会停止当前这一段,已经完成的段落会保留,之后可以从第一个未完成的段落继续。diff --git a/freevideo_engine/comfy_chain.py b/freevideo_engine/comfy_chain.pyindex ec3648b..cb50be2 100644--- a/freevideo_engine/comfy_chain.py+++ b/freevideo_engine/comfy_chain.py@@ -331,9 +331,13 @@ def register(host_factory=None):async def plan(request):try:value = await body(request)- return response({'plan': chain_plan.plan(+ result = chain_plan.plan(value.get('seconds'), value.get('single', False), value.get('max_frames'),- value.get('single_limit_seconds'), value.get('block_seconds'))})+ value.get('single_limit_seconds'), value.get('block_seconds'))+ if not result['single'] and not continuation_supported():+ # A device that cannot continue a video has one block to give: never a plan in parts.+ raise chain_plan.PlanError('device_limit', 'This device cannot generate this length at this size')+ return response({'plan': result})except chain_plan.PlanError as failure:return response({'error': str(failure), 'code': failure.code}, 400)except ValueError as failure:diff --git a/web/first_run_guide.js b/web/first_run_guide.jsindex 3b6f5f1..5193e63 100644--- a/web/first_run_guide.js+++ b/web/first_run_guide.js@@ -10,18 +10,25 @@ export const REPLAY_TEXT = {waiting: ['Waiting for the workspace to be ready. The guide will start automatically.', '正在等待创作面板就绪,随后会自动开始指引。'],cancel: ['Cancel', '取消'],unavailable: ['Open a creation workflow to view the guide.', '请先打开创作工作流,再查看指引。'],+ manual: ['User guide', '使用说明'],};+// The written guide is in Chinese only, so only the Chinese interface links it.+export const MANUAL_URL = 'https://github.com/FlashML-org/FreeVideo/blob/main/docs/zh-CN/%E4%BD%BF%E7%94%A8%E8%AF%B4%E6%98%8E.md';export const CHAPTERS = [{id: 'describe', anchor: '[data-fv-guide="describe"]', added: false,en: 'Type your prompt here. You can have an agent follow the Skill at the top right, or turn on FreeToken enhancement.',zh: '在这里输入提示词。可以让 Agent 参考 Skill,或开启 FreeToken 提示词增强。'},+ {id: 'media', anchor: '[data-fv-guide="media"]', added: true,+ en: 'Add reference images or a first or last frame here. Type @ in the prompt to use them.',+ zh: '在这里添加参\u2060考\u2060图、首\u2060帧或尾\u2060帧,在描述里输入 @ 引用。'},{id: 'range', anchor: '[data-fv-guide="range"]', added: true,en: 'See the available sizes and lengths here, and how long each takes.', zh: '在这里查看可生成的尺\u2060寸、时长和预计用时。'},{id: 'generate', anchor: '[data-fv-guide="generate"]', added: false,en: 'Choose "Generate video". Progress and the time left appear in the preview.', zh: '点“生成视频”,进度和剩\u2060余\u2060时\u2060间会显示在预览区。'},{id: 'longer', anchor: '[data-fv-guide="longer"]', added: true,- en: 'For a longer video, or to change part of one, choose "Edit".', zh: '要做更长的视频,或者修\u2060改\u2060其\u2060中\u2060一\u2060段,点“剪辑视图”。'},+ en: 'For a longer video, enter a longer duration and it is made in parts automatically. You can also add parts one by one in "Edit".',+ zh: '要做更长的视频,把时长填长一些,会自动分段生成;也可以在“剪辑视图”里一段段接。'},{id: 'agent', anchor: '[data-fv-guide="agent"]', added: true,en: 'To have an AI agent such as Claude Code or Codex make videos for you, choose "Autopilot".', zh: '要让 Claude Code、Codex 等 Agent 替你生\u2060成\u2060视\u2060频,点“AI 全自动”。'},{id: 'editor-timeline', group: 'editor', anchor: '[data-fv-guide="editor-timeline"]', added: true,@@ -117,7 +124,13 @@ export function createGuideReplayEntry({dialog, cn, openWorkspace, replay = showconst section = el('section', null, 'fv-guide-replay'), row = el('div', null, 'fv-guide-replay-row');const button = el('button', text('again')); button.type = 'button';const status = el('div', null, 'fv-muted'); status.setAttribute('role', 'status'); status.hidden = true;- row.append(el('h3', text('title')), button); section.append(row, status);+ const actions = el('div', null, 'fv-guide-replay-actions');+ if (cn) {+ const manual = el('a', text('manual')); manual.href = MANUAL_URL; manual.target = '_blank'; manual.rel = 'noopener noreferrer';+ actions.append(manual);+ }+ actions.append(button);+ row.append(el('h3', text('title')), actions); section.append(row, status);button.onclick = async () => {button.disabled = true;try {diff --git a/web/setup.css b/web/setup.cssindex 1ece75a..6f30a70 100644--- a/web/setup.css+++ b/web/setup.css@@ -23,6 +23,7 @@.fv-setup h3{font-size:var(--fv-body);font-weight:var(--fv-semibold);margin:0 0 12px}.fv-setup .fv-guide-replay-row{display:flex;align-items:center;justify-content:space-between;gap:16px}.fv-setup .fv-guide-replay-row h3{margin:0}+.fv-setup .fv-guide-replay-actions{display:flex;align-items:center;gap:16px}.fv-setup .fv-guide-replay [role=status]{margin-top:8px}/* Sections: one card each; details use the Studio's chevron, not the UA marker. */diff --git a/web/studio.css b/web/studio.cssindex 1bb5e99..0f8b32a 100644--- a/web/studio.css+++ b/web/studio.css@@ -19,6 +19,7 @@.fv-studio .fv-label{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:10px;font-weight:var(--fv-semibold);color:var(--fv-ink);font-size:var(--fv-body)}.fv-studio .fv-muted{color:var(--fv-muted);font-size:var(--fv-micro);font-weight:var(--fv-regular)}.fv-studio .fv-section{margin-bottom:23px}.fv-studio .fv-section-title{font-size:var(--fv-body);font-weight:var(--fv-semibold);list-style:none;cursor:pointer;display:flex;align-items:center;justify-content:space-between}+.fv-studio .fv-section-hint{flex:1;min-width:0;margin:0 12px 0 10px;font-size:12px;font-weight:400;color:var(--fv-muted);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.fv-studio .fv-section-hint[hidden]{display:none}.fv-studio .fv-section-title::after{content:'';width:6px;height:6px;margin-right:3px;border-right:1.5px solid var(--fv-muted);border-bottom:1.5px solid var(--fv-muted);transform:rotate(45deg);transition:transform .24s}.fv-studio details[open]:not([data-expanded=false])>.fv-section-title::after{transform:rotate(225deg)}.fv-studio details>summary::-webkit-details-marker{display:none}.fv-studio .fv-expand{padding-top:14px}.fv-studio textarea,.fv-studio select,.fv-studio input[type=number]{border:1px solid var(--fv-border);background:var(--fv-card);color:var(--fv-ink);padding:8px 12px;width:100%;outline:none}diff --git a/web/studio.js b/web/studio.jsindex c964f88..8feea8a 100644--- a/web/studio.js+++ b/web/studio.js@@ -810,12 +810,27 @@ export function openStudio(node, {extendFrom = null} = {}) {canvas.append(samplingSettings); cleanup.push(() => effort.dispose());cleanup.push(() => { clearTimeout(effortEstimateTimer); effortEstimateRequest?.abort(); });const mediaNode = upstream(node, 'media');+ const mediaFilled = () => JSON.parse(value(mediaNode, 'assets') || '[]').some(r => r.enabled !== false)+ || Boolean(mediaNode.inputs?.some(input => ['first', 'last', ...referenceInputs, 'reference_audio'].includes(input.name) && input.link != null));+ // The line beside the closed title says what the section is for, until something is added.+ // The guide opens the section it points at; the ring stays on the title row.+ const mediaGuideTarget = () => {+ if (!mediaNode?.freevideoCreateMediaEditor) return null;+ const r = mediaTitle.getBoundingClientRect();+ return {node: mediaTitle, rect: {left: r.left, top: r.top, right: r.right, bottom: r.bottom, width: r.width, height: r.height},+ reveal: () => { mediaDetails.open = true; }};+ };+ const paintMediaHint = () => { try { mediaHint.hidden = mediaDetails.open || !mediaNode?.freevideoCreateMediaEditor || mediaFilled(); } catch { mediaHint.hidden = true; } };const [mediaDetails, mediaMount] = expand(t('Media', '素材'));+ const mediaTitle = mediaDetails.querySelector('summary'), mediaHint = el('span', t('Reference images, first and last frames', '参考图、首帧、尾帧'), 'fv-section-hint');+ mediaTitle.dataset.fvGuide = 'media'; mediaTitle.append(mediaHint);const extendMount = el('div', null, 'fv-extend-source'); extendMount.hidden = true; mediaMount.prepend(extendMount);let releaseExtendThumbnail = () => {};cleanup.push(() => releaseExtendThumbnail());- if (mediaNode?.freevideoCreateMediaEditor) { cleanup.push(mediaNode.freevideoCreateMediaEditor(mediaMount)); mediaDetails.open = JSON.parse(value(mediaNode, 'assets') || '[]').some(r => r.enabled !== false) || mediaNode.inputs?.some(input => ['first', 'last', ...referenceInputs, 'reference_audio'].includes(input.name) && input.link != null); }+ if (mediaNode?.freevideoCreateMediaEditor) { cleanup.push(mediaNode.freevideoCreateMediaEditor(mediaMount)); mediaDetails.open = mediaFilled(); }else mediaMount.append(el('p', t('Connect a FreeVideo Media panel in node view to upload here.', '在节点视图连接 FreeVideo 素材面板,即可在这里上传。'), 'fv-legacy'));+ paintMediaHint(); mediaDetails.addEventListener('toggle', paintMediaHint);+ controls.addEventListener('change', paintMediaHint, true); controls.addEventListener('input', paintMediaHint, true);const connectedLora = upstream(node, 'loras');const loraNode = connectedLora?.properties?.[CREATED_BY_PANEL] ? pendingLoras(node, connectedLora) : connectedLora || pendingLoras(node);const [loraDetails, loraMount] = expand(t('LoRA', 'LoRA'));@@ -1433,7 +1448,7 @@ export function openStudio(node, {extendFrom = null} = {}) {const wasBusy = busy;busy = Boolean(active) || progressLive(); queued = !state.running && Boolean(state.pending.length);// A finished, failed or cancelled video may have downloaded what the line above Generate still lists.- if (wasBusy && !busy) requestAssets?.refresh(true);+ if (wasBusy && !busy) { requestAssets?.refresh(true); paintMediaHint(); }const g = active?.inputs;// The right-hand frame belongs to the submitted video. Draft edits on// the left must never reshape a video currently being generated.@@ -1745,7 +1760,7 @@ export function openStudio(node, {extendFrom = null} = {}) {let guide = null, closed = false;cleanup.push(() => { closed = true; guide?.dispose(); });agentDiscovery.then(() => {- if (!closed) guide = createFirstRunGuide({dialog, api, cn, isBusy: () => busy || queued || capturing});+ if (!closed) guide = createFirstRunGuide({dialog, api, cn, isBusy: () => busy || queued || capturing, targets: {media: mediaGuideTarget}});});const recentLoad = recent.refresh();if (node.freevideoProgress && !node.freevideoProgress.chain) showProgress(node.freevideoProgress);diff --git a/web/studio_length.js b/web/studio_length.jsindex 4d889fe..05344b8 100644--- a/web/studio_length.js+++ b/web/studio_length.js@@ -40,6 +40,11 @@ export function createStudioLength({api, node, seconds, advanced, fields, t, fiecontrols.append(toggle, explanation, unavailable, field(t('Part length · seconds', '每段时长 · 秒'), block), reset); advanced.append(controls);const note = el('div', 'fv-muted fv-length-plan');note.hidden = true; fields.after(note); note.setAttribute('role', 'status');+ // The limits are stated before anything is typed, not only when a request is refused.+ const NO_PARTS = t('This device cannot make longer videos in parts.', '此设备不支持分段生成长视频。');+ let noParts = false;+ const hint = el('p', 'fv-muted fv-length-hint', t('Longer videos are made in parts automatically, up to 5 parts.', '较长的视频会自动分段,最多 5 段。'));+ fields.after(hint);let limits = null, planLimits = null, contextKey = '', revision = 0, timer = null, request = null, capabilityRequest = null, capabilityRevision = 0;let capabilityState = 'idle', waiting = false, waitingTimer = null, timeoutTimer = null, submitted = false;let plan = null, error = null, absent = false, disposed = false, pending = null, edited = false, blockEdited = false;@@ -73,12 +78,16 @@ export function createStudioLength({api, node, seconds, advanced, fields, t, fieblock.title = !block.disabled || absent || seconds.disabled || effectiveSingle() ? '': t('These settings cannot generate in parts.', '当前设置不能分段生成。');reset.title = block.title;+ // The same sentence is the problem note once a length needs parts: say it once.+ hint.hidden = absent || (noParts && Boolean(error));note.hidden = absent || !error;note.textContent = error ? errorMessage(error) : '';+ note.style.margin = noParts && error === 'continuation_unavailable' ? '12px 0' : ''; // as spaced as the line it replaces}function errorMessage(kind) {return {single_unavailable: t('This length is beyond a single run.', '这个长度超出了单次能生成的范围。'),- continuation_unavailable: t('Choose a smaller picture size to make a longer video.', '如需生成更长的视频,请选择更小的画面大小。'),+ continuation_unavailable: noParts ? NO_PARTS+ : t('Choose a smaller picture size to make a longer video.', '如需生成更长的视频,请选择更小的画面大小。'),too_long: t('This video is too long. Choose a shorter duration.', '这条视频太长,请缩短时长。'),other: t('Could not plan this video. Try again.', '暂时无法安排这条视频的分段,请重试。')}[kind];}@@ -124,6 +133,11 @@ export function createStudioLength({api, node, seconds, advanced, fields, t, fiesetSeconds(Math.min(60, value)); invalidate(); schedule(); return true;}paint();+ // Devices that cannot continue a video say so up front. An unreadable answer keeps the general line.+ Promise.resolve().then(() => api.fetchApi('/freevideo/chains')).then(reply => reply?.ok ? reply.json() : null).then(value => {+ if (disposed || value?.continuation !== false) return;+ noParts = true; hint.textContent = NO_PARTS; invalidate(); schedule();+ }).catch(() => {});return {commit, options, get plan() { return plan; }, get absent() { return absent; },get needsPlan() { return !absent && !effectiveSingle() && (total() > singleLimitSeconds(planLimits?.maximum)