Skip to content

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 part that continues a finished video is generated at that video's picture size

Bowen Xuec57739263237
diff --git a/web/editor.js b/web/editor.js
index d156095..2014834 100644
--- a/web/editor.js
+++ b/web/editor.js
@@ -6,7 +6,7 @@ import {openSetup} from './setup.js';
import * as model from './editor_model.js';
import {createEditorState} from './editor_state.js';
import {createEditorStore, sourceKey, mediaURL} from './editor_store.js';
-import {generationSize} from './editor_generation.js';
+import {generationSize, continuedSize} from './editor_generation.js';
import {createEditorLibrary} from './editor_library.js';
import {createEditorPlayer} from './editor_player.js';
import {createEditorTransport, registerEditorShortcuts} from './editor_transport.js';
@@ -506,7 +506,12 @@ export function openEditor({api, app, from = null, panel = {}, components: given
submittedSelection = state.select({kind: 'clip', ids}); await completeSources();
const paths = Object.fromEntries([...store.sources].map(([key, value]) => [key, value.path]));
const request = model.generationRequest(prepared, ids, {text, paths});
- const tooLong = request.blocks.filter(block => capability.maxRequestFrames != null && block.frames > capability.maxRequestFrames);
+ 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.
+ const limit = (follow && (follow.width !== edit.width || follow.height !== edit.height)
+ ? await store.requestFrames(follow, state.record.settings) : null) ?? capability.maxRequestFrames;
+ const tooLong = request.blocks.filter(block => limit != null && block.frames > limit);
if (tooLong.length) {
state.settle(record => tooLong.reduce((next, block) => model.fail(next, block.id, 'too_long', null), record));
return;
diff --git a/web/editor_generation.js b/web/editor_generation.js
index 65512c2..4bf818d 100644
--- a/web/editor_generation.js
+++ b/web/editor_generation.js
@@ -13,3 +13,12 @@ export function generationSize(project, sizes = []) {
|| Math.abs(a.width * a.height - area) - Math.abs(b.width * b.height - area));
return {width: candidates[0].width, height: candidates[0].height};
}
+// A part that continues finished footage is made at that footage's size, whatever the edit's own: the size all the
+// footage a request continues has in common. null when a video in the request starts fresh or the sizes differ; the
+// edit's size then stands.
+export function continuedSize(before, sources) {
+ const sizes = before.map(key => key && sources.get(key));
+ if (!sizes.length || !sizes.every(valid)) return null;
+ const {width, height} = sizes[0];
+ return sizes.every(size => size.width === width && size.height === height) ? {width, height} : null;
+}
diff --git a/web/editor_model.js b/web/editor_model.js
index cb83814..0c80ecf 100644
--- a/web/editor_model.js
+++ b/web/editor_model.js
@@ -933,6 +933,12 @@ export function prepare(record, ids) {
}
return finish(next);
}
+// The finished footage each video of a generation request continues, as source keys; null for one that starts fresh.
+export function generationBefore(record, ids) {
+ const clips = generationClips(record, ids);
+ return generationPlan(record, clips).filter(row => !row.before || !clips.some(clip => clip.id === row.before.id))
+ .map(row => row.before ? key(row.before.source) : null);
+}
export function generationRequest(record, ids, {text, paths = {}} = {}) {
check(object(paths), 'source');
if (text !== undefined) check(validText(text), 'text');
diff --git a/web/editor_store.js b/web/editor_store.js
index c27ba23..eae650d 100644
--- a/web/editor_store.js
+++ b/web/editor_store.js
@@ -391,6 +391,18 @@ export function createEditorStore(api, {t = en => en, notify = () => {}, onGener
// these limits; only the callback publishes a measured capability.
read(); return fallback;
},
+ // The longest single part this computer makes at a size other than the edit's; null when it cannot be told.
+ async requestFrames(size, settings) {
+ try {
+ for (let tries = 0; tries < 5 && !disposed; tries++) {
+ const reply = await json('/freevideo/capabilities?' + new URLSearchParams(size));
+ if (reply?.status !== 'computing') return !reply || (reply.status && reply.status !== 'ready') ? null
+ : capabilityPoints(reply, {...size, settings}).maxRequestFrames;
+ await new Promise(done => clock.setTimeout(done, 1000));
+ }
+ } catch { /* not known */ }
+ return null;
+ },
async startChain(payload) {
if (standIn) return standIn.startChain(payload);
if (!generationAvailable) return null;