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.

Media node: a workflow saved before Audio use existed runs with its audio as a reference

Bowen Xue6b822608a93f
diff --git a/freevideo_engine/comfy_nodes.py b/freevideo_engine/comfy_nodes.py
index eee19b3..9f36a61 100644
--- a/freevideo_engine/comfy_nodes.py
+++ b/freevideo_engine/comfy_nodes.py
@@ -73,6 +73,13 @@ def upscale_option(value):
return {'upscale_factor': float(text)} if text in UPSCALE_OPTIONS and text != '2' else {}
+def audio_use_option(value):
+ """Audio use for the Media and Reference widgets: missing or empty means Reference, as before the
+ widget existed. Workflows saved before it existed hold the panel's '' in its position; any other
+ value is checked as given (original_audio.fields)."""
+ return 'reference' if value is None or value == '' else value
+
+
class FreeVideoGenerate(io.ComfyNode):
@classmethod
def define_schema(cls):
@@ -460,7 +467,7 @@ class FreeVideoMedia(io.ComfyNode):
import folder_paths
return io.NodeOutput(connect_assets(resolve_assets(assets, folder_paths.get_input_directory()),
first=first, last=last, reference=reference,
- reference_audio=reference_audio, audio_use=audio_use, **images))
+ reference_audio=reference_audio, audio_use=audio_use_option(audio_use), **images))
class FreeVideoReference(io.ComfyNode):
@@ -484,6 +491,7 @@ class FreeVideoReference(io.ComfyNode):
if len(result) >= 32:
raise ValueError('At most 32 ordered references; memory is checked against the actual request')
kind, value = values[0]
+ use = audio_use_option(use)
from .original_audio import fields, original
options = fields(dict(kind=kind, **({'use': use} if use != 'reference' or kind == 'audio' else {})))
result.append({'kind': kind, 'value': value, **options})
diff --git a/scripts/test_freevideo_entry.mjs b/scripts/test_freevideo_entry.mjs
index af7ca94..d237cbe 100644
--- a/scripts/test_freevideo_entry.mjs
+++ b/scripts/test_freevideo_entry.mjs
@@ -10,7 +10,7 @@ import {outputDownloadURL} from '../web/output_download.js';
import {regenerateResult, upscaleResult, createSecondPassQueue, enableNode} from '../web/studio_queue.js';
import {referenceInputs, mediaRows} from '../web/prompt_references.js';
import {expandCast} from '../web/cast_mention.js';
-import {cleanOptionalPrompt, cleanOptionalWidgets, optionalInputValue} from '../web/optional_inputs.js';
+import {cleanAudioUse, cleanOptionalPrompt, cleanOptionalWidgets, optionalInputValue} from '../web/optional_inputs.js';
class Element {
constructor(tag) {
@@ -59,7 +59,7 @@ test('main browser entry registers both views and preserves node hooks', async t
createElementNS: (namespaceURI, tag) => Object.assign(new Element(tag), {namespaceURI}),
createRange: () => ({createContextualFragment: () => new Element('span')})};
const dependencies = {
- app, api, uploadMedia, outputDownloadURL, regenerateResult, upscaleResult, createSecondPassQueue, enableNode, referenceInputs, mediaRows, expandCast, cleanOptionalPrompt, cleanOptionalWidgets, optionalInputValue,
+ app, api, uploadMedia, outputDownloadURL, regenerateResult, upscaleResult, createSecondPassQueue, enableNode, referenceInputs, mediaRows, expandCast, cleanAudioUse, cleanOptionalPrompt, cleanOptionalWidgets, optionalInputValue,
createCastLibrary: options => {
const cast = {element: new Element('cast'), options, destroyed: false, destroy() { this.destroyed = true; }};
casts.push(cast); return cast;
@@ -133,7 +133,7 @@ test('main browser entry registers both views and preserves node hooks', async t
.replace("import { shareButton } from './share.js';", 'const {shareButton} = globalThis.__freevideoEntryTest;')
.replace("import { reportFileName } from './report_issue.js';", 'const {reportFileName} = globalThis.__freevideoEntryTest;')
.replace("import { rememberPromptDraft, savePromptDraft, trackPromptDraft, watchPromptHistory, promptHistoryRestoring } from './prompt_draft.js';", 'const {rememberPromptDraft,savePromptDraft} = globalThis.__freevideoEntryTest; const trackPromptDraft = () => {}; const watchPromptHistory = () => {}; const promptHistoryRestoring = () => false;')
- .replace("import { cleanOptionalWidgets, cleanOptionalPrompt, optionalInputValue } from './optional_inputs.js';", 'const {cleanOptionalWidgets,cleanOptionalPrompt,optionalInputValue} = globalThis.__freevideoEntryTest;')
+ .replace("import { cleanOptionalWidgets, cleanOptionalPrompt, optionalInputValue, cleanAudioUse } from './optional_inputs.js';", 'const {cleanOptionalWidgets,cleanOptionalPrompt,optionalInputValue,cleanAudioUse} = globalThis.__freevideoEntryTest;')
.replace("import { regenerateResult, upscaleResult } from './studio_queue.js';", 'const {regenerateResult,upscaleResult} = globalThis.__freevideoEntryTest;')
.replace("import { regenerateResult, createSecondPassQueue, enableNode } from './studio_queue.js';", 'const {regenerateResult,createSecondPassQueue,enableNode} = globalThis.__freevideoEntryTest;')
.replace("import { secondPassAction } from './result_actions.js';", 'const {secondPassAction} = globalThis.__freevideoEntryTest;')
diff --git a/web/freevideo.js b/web/freevideo.js
index 21aec7b..dd9fb93 100644
--- a/web/freevideo.js
+++ b/web/freevideo.js
@@ -22,7 +22,7 @@ import { outputDownloadURL } from './output_download.js';
import { shareButton } from './share.js';
import { reportFileName } from './report_issue.js';
import { rememberPromptDraft, savePromptDraft, trackPromptDraft, watchPromptHistory, promptHistoryRestoring } from './prompt_draft.js';
-import { cleanOptionalWidgets, cleanOptionalPrompt, optionalInputValue } from './optional_inputs.js';
+import { cleanOptionalWidgets, cleanOptionalPrompt, optionalInputValue, cleanAudioUse } from './optional_inputs.js';
import { regenerateResult, createSecondPassQueue, enableNode } from './studio_queue.js';
import { secondPassAction } from './result_actions.js';
import { openImageEditor, icon } from './image_editor.js';
@@ -452,7 +452,7 @@ function mediaPanel(node, mount = null) {
const removed = node.onRemoved;
node.onRemoved = function (...args) { dispose(); return removed?.apply(this, args); };
const configure = node.onConfigure;
- node.onConfigure = function (...args) { const result = configure?.apply(this, args); queueMicrotask(() => { syncReferenceSockets(node); render(); }); return result; };
+ node.onConfigure = function (...args) { const result = configure?.apply(this, args); cleanAudioUse(node); queueMicrotask(() => { syncReferenceSockets(node); render(); }); return result; };
const connectionChanged = node.onConnectionsChange;
node.onConnectionsChange = function (...args) { const result = connectionChanged?.apply(this, args); queueMicrotask(() => { syncReferenceSockets(node); update(read()); }); return result; };
syncReferenceSockets(node); node.setSize([460, 460]); render();
diff --git a/web/optional_inputs.js b/web/optional_inputs.js
index f87e547..a5802b1 100644
--- a/web/optional_inputs.js
+++ b/web/optional_inputs.js
@@ -69,6 +69,13 @@ export function cleanOptionalWidgets(node) {
}
}
+// Audio use came after the Media node's panel, which an older save keeps as '' in that position:
+// such a workflow, or one without the value, reads as Reference and is saved with it from then on.
+export function cleanAudioUse(node) {
+ const widget = node?.widgets?.find(w => w.name === 'audio_use');
+ if (widget && (widget.value === '' || widget.value == null)) widget.value = 'reference';
+}
+
// The user chose to generate without a description: this request alone says so; the node's own widgets never keep it.
export function allowEmptyPrompt(prompt, nodeId) {
const inputs = prompt?.output?.[String(nodeId)]?.inputs;