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.
Editing view: a continuing part counts only reference images toward its three
Bowen Xue8aa13d281913
diff --git a/web/editor.js b/web/editor.jsindex 28bfca7..ff98c0c 100644--- a/web/editor.js+++ b/web/editor.js@@ -319,9 +319,9 @@ export function openEditor({api, app, from = null, panel = {}, components: givenconst start = Math.min(...clips.map(clip => clip.start));return {start, frames: Math.max(...clips.map(clip => clip.start + clip.frames)) - start};}- // Whether the part about to be made starts fresh instead of continuing footage: only then can pictures guide it.- function startsFresh() {- const range = selectionRange(); if (!range) return false;+ // How the part about to be made starts: 'fresh' (pictures can guide it), 'continues' (from the footage before it) or null.+ function partStart() {+ const range = selectionRange(); if (!range) return null;try {const selected = selectionClips();const planned = selected.length && selected.every(clip => clip.pending && !clip.source)@@ -329,8 +329,9 @@ export function openEditor({api, app, from = null, panel = {}, components: given: model.planRange(state.record, {...range, target: 'both', text: 'x', maxSeconds: capability.maxSeconds, maxFollowSeconds: capability.maxFollowSeconds});const ids = planned.tracks[0].clips.filter(clip => clip.start >= range.start && clip.start < range.start + range.frames&& clip.pending && !['queued', 'running'].includes(clip.pending)).map(clip => clip.id);- return ids.length > 0 && model.generationBefore(model.prepare(planned, ids), ids).some(before => before == null);- } catch (value) { if (value instanceof model.EditError) return false; throw value; }+ if (!ids.length) return null;+ return model.generationBefore(model.prepare(planned, ids), ids).some(before => before == null) ? 'fresh' : 'continues';+ } catch (value) { if (value instanceof model.EditError) return null; throw value; }}const jobActive = () => generationBusy || [...jobStatuses.values()].some(job => ['queued', 'running', 'cancelling'].includes(job.state));// Parts pressed while they cannot be sent yet: the engine is still starting, or they continue a part@@ -473,7 +474,7 @@ export function openEditor({api, app, from = null, panel = {}, components: givenif (!value.node || !value.prompt?.[value.node]) throw new Error('missing_node');const inputs = value.prompt[value.node].inputs;Object.assign(inputs, state.record.settings || {}, capability.generationSize || generationSize(state.record));- // The media panel's pictures guide a part that starts fresh (generate() drops them when every part continues footage);+ // The media panel's pictures guide every part (the engine keeps only the references for a part that continues);// without a panel to show them they stay out of the request.if (!panel.references?.available()) delete inputs.media;delete inputs.continue_from; delete inputs.continue_to;@@ -730,9 +731,9 @@ export function openEditor({api, app, from = null, panel = {}, components: givenclip.start + clip.frames === range.start && clip.source && clip.extend && clip.in + clip.frames === clip.length);return before || model.rangeParts(state.record, {...range, ...capability}).length > 1;},- // Pictures that guide a new part: the creative panel's media rows, shown while the part starts fresh.+ // Pictures that guide a new part: the creative panel's media rows; a part that continues shows only its references.references: panel.references ? {source: panel.references, notify, size: () => capability.generationSize || generationSize(state.record),- visible: () => store.generationAvailable && actions.supportedSelection() && startsFresh()} : null,+ visible: () => store.generationAvailable && actions.supportedSelection() ? partStart() : null} : null,setFirstFrame: value => { state.apply(t('First-frame reference', '首帧参考'), record => model.setFlag(record, 'first_frame_reference', value)); },previewRange: selection => genbar?.preview(selection),async estimate(selection) {@@ -768,8 +769,6 @@ export function openEditor({api, app, from = null, panel = {}, components: givensubmittedSelection = shown && state.selection === selection ? state.select({kind: 'clip', ids}) : state.selection; await completeSources();const paths = Object.fromEntries([...store.sources].map(([key, value]) => [key, value.path]));const request = model.generationRequest(prepared, ids, {text, paths});- // Pictures guide parts that start fresh; a request whose parts all continue footage carries none.- if (!request.blocks.some(block => !block.after)) delete frozen.prompt[frozen.node].inputs.media;const follow = continuedSize(model.generationBefore(prepared, ids), store.sources), edit = capability.generationSize || generationSize(state.record);Object.assign(frozen.prompt[frozen.node].inputs, follow || {});// Parts made at another size than the edit's have that size's limit.diff --git a/web/editor_genbar.js b/web/editor_genbar.jsindex 0bfb690..d9aeb56 100644--- a/web/editor_genbar.js+++ b/web/editor_genbar.js@@ -108,7 +108,7 @@ export function createEditorGenbar(host, {state, t, actions, text = ''}) {hint.title = shown.map(([, text]) => text).join('');}firstFrame.update(busy);- references?.update(busy, busy ? undefined : !!actions.references.visible());+ references?.update(busy, busy ? undefined : actions.references.visible() || false);generate.textContent = t('Generate', '生成');// Never disabled for a reason the press itself can explain or fix.generate.disabled = busy || !!previewSelection;diff --git a/web/editor_references.js b/web/editor_references.jsindex 5f2f8ec..4bd6f80 100644--- a/web/editor_references.js+++ b/web/editor_references.js@@ -1,8 +1,11 @@// Reference pictures for a new part, kept small inside the generation bar: thumbnails and one "+".+// A part that continues the one before keeps its reference pictures (people stay the same) but not its first or last frame.// `source` is the media rows of the creative panel (editor_media_references.js); `size()` is the video's shape.const el = (tag, cls, text) => { const e = document.createElement(tag); if (cls) e.className = cls; if (text != null) e.textContent = text; return e; };const IMAGE = /\.(png|jpe?g|webp|bmp|tiff?)$/i;const MAX = 32;+// The engine keeps the first three references of a part that continues.+const CONTINUE_MAX = 3;export function createEditorReferences({t, source, size = () => null, error = () => {}, notify = () => {}}) {const root = el('div', 'fv-ed-refs'), chips = el('div', 'fv-ed-ref-chips');const add = el('button', 'fv-ed-ref-add'); add.type = 'button';@@ -12,12 +15,16 @@ export function createEditorReferences({t, source, size = () => null, error = ()const menu = el('div', 'fv-ed-ref-menu'); menu.hidden = true; menu.setAttribute('role', 'menu');const picker = el('input'); picker.type = 'file'; picker.accept = 'image/*'; picker.multiple = true; picker.hidden = true;root.append(add, chips, menu, picker);- let shown = false, busy = false, working = false, opener = null, disposed = false, entries = [], waited = false;+ let shown = false, continuing = false, busy = false, working = false, opener = null, disposed = false, entries = [], waited = false;const active = () => source.rows().map((row, index) => ({row, index})).filter(({row}) => row.enabled !== false);const isImage = file => IMAGE.test(file || '');+ // The pictures this part uses: all of them, or the first reference images of a part that continues+ // (sound or video references do not count there, as the engine skips them).+ const used = () => continuing ? active().filter(({row}) => (row.role || 'reference') === 'reference' && isImage(row.file)).slice(0, CONTINUE_MAX) : active();+ const full = () => continuing ? used().length >= CONTINUE_MAX : active().length >= MAX;// On hover without a full stop; in the notice line with one.const waitText = () => t('Available after generation finishes', '生成完成后可改');- const fullText = () => t('Up to 32 images', '最多 32\u00a0张');+ const fullText = () => continuing ? t('Up to 3 images when continuing', '接续时最多 3\u00a0张') : t('Up to 32 images', '最多 32\u00a0张');const sentence = text => text + t('.', '。');const label = role => role === 'first' ? t('First frame', '首帧') : role === 'last' ? t('Last frame', '尾帧') : t('Reference', '参考');function close(focus = true) {@@ -58,7 +65,7 @@ export function createEditorReferences({t, source, size = () => null, error = ()working = true; update();try {for (const file of files) {- if (active().length >= MAX) break;+ if (full()) break;const result = await source.upload(file);write([...source.rows(), {file: result.file, role: 'reference', enabled: true}]);}@@ -93,6 +100,11 @@ export function createEditorReferences({t, source, size = () => null, error = ()}function chipMenu(entry) {entries = [];+ const remove = () => item(t('Remove', '移除'), () => {+ const rows = source.rows();+ if (rows[entry.index]?.file === entry.row.file) { rows[entry.index] = {...rows[entry.index], enabled: false}; write(rows); }+ });+ if (continuing) return [remove()];const roles = ['reference', 'first', 'last'].map(role => {const b = item(label(role), () => {const rows = source.rows();@@ -104,25 +116,23 @@ export function createEditorReferences({t, source, size = () => null, error = ()b.setAttribute('aria-checked', String((entry.row.role || 'reference') === role)); return b;});const separator = el('div'); separator.setAttribute('role', 'separator');- return [...roles, separator, item(t('Remove', '移除'), () => {- const rows = source.rows();- if (rows[entry.index]?.file === entry.row.file) { rows[entry.index] = {...rows[entry.index], enabled: false}; write(rows); }- })];+ return [...roles, separator, remove()];}// The line said on a click while a part is made; it goes away with the busy state it describes.const wait = () => { waited = true; notify(sentence(waitText())); };function update(isBusy = busy, visible = shown) {if (waited && busy && !isBusy) { waited = false; notify(''); }- busy = isBusy; shown = visible;+ const was = continuing;+ busy = isBusy; shown = visible; continuing = shown === 'continues';root.hidden = !shown || !source.available();- if ((root.hidden || busy) && !menu.hidden) close(false);- // The panel holds at most MAX pictures: a full list greys the plus out rather than ignoring a click.- const full = active().length >= MAX;+ if ((root.hidden || busy || was !== continuing) && !menu.hidden) close(false);+ // The panel holds at most MAX pictures, a continuing part uses three: a full list greys the plus out rather than ignoring a click.+ const isFull = full();// While a part is being made the controls stay clickable and say why they do nothing.add.disabled = working;- add.setAttribute('aria-disabled', String(busy || full));- add.title = busy ? waitText() : full ? fullText() : t('Reference image', '参考图');- chips.replaceChildren(...active().map(entry => {+ add.setAttribute('aria-disabled', String(busy || isFull));+ add.title = busy ? waitText() : isFull ? fullText() : t('Reference image', '参考图');+ chips.replaceChildren(...used().map(entry => {const chip = el('button', 'fv-ed-ref-chip'); chip.type = 'button'; chip.disabled = working; chip.setAttribute('aria-disabled', String(busy));chip.dataset.role = entry.row.role || 'reference';chip.title = busy ? waitText() : label(entry.row.role); chip.setAttribute('aria-haspopup', 'menu');@@ -134,7 +144,7 @@ export function createEditorReferences({t, source, size = () => null, error = ()}add.onclick = () => {if (busy) { wait(); return; }- if (active().length >= MAX) { notify(sentence(fullText())); return; }+ if (full()) { notify(sentence(fullText())); return; }if (!menu.hidden && opener === add) close(); else open(add, addMenu()); };picker.onchange = () => addFiles(Array.from(picker.files));// Keys stay in the menu: Escape closes it only, and the arrows move through it.