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.

Continuing a video: first and last frame images become reference pictures, two-pass and preview...

Bowen Xuea35b0be0e385
diff --git a/freevideo_engine/agent/drama.py b/freevideo_engine/agent/drama.py
index 25ea15a..a9ce60e 100644
--- a/freevideo_engine/agent/drama.py
+++ b/freevideo_engine/agent/drama.py
@@ -329,7 +329,7 @@ def cast_references(play, shot, cards, *, continues=False, each=PICTURES_EACH):
function serves plan previews and the moment a take is submitted. each is
the most pictures one person carries; pictures_each says what was used.
cast_reference: None (no character in the shot has a card), 'own' (the shot
- names its own first frame or references), 'missing' (a card was deleted),
+ names its own first frame or references; an empty list means no pictures), 'missing' (a card was deleted),
'partial' (not everyone fit) or 'cards'. 'omitted' lists people left out
entirely; 'voice_omitted' lists people whose pictures are carried but whose
voice did not fit. A shot that continues the previous one carries one picture
@@ -341,7 +341,8 @@ def cast_references(play, shot, cards, *, continues=False, each=PICTURES_EACH):
prefix=None, subjects=[], cards={}, pictures_each=each, clip_seconds=[])
if not keys:
return result
- if shot.get('first') is not None or shot.get('references'):
+ # A references list, even an empty one, is the shot's own choice: cards are added only when it is left out.
+ if shot.get('first') is not None or isinstance(shot.get('references'), list):
result['cast_reference'] = 'own'
return result
spoken = {}
diff --git a/freevideo_engine/agent/guide.py b/freevideo_engine/agent/guide.py
index d981749..5c6d0a1 100644
--- a/freevideo_engine/agent/guide.py
+++ b/freevideo_engine/agent/guide.py
@@ -534,8 +534,9 @@ GUIDE['cast'] = [
'Changes need the revision you read (body revision or If-Match); stale_revision returns the current card in '
'error.card. Fields the user changed return changed_by_user: keep the user\'s version.',
'Film with a card by setting characters.<key>.card. Cards are read when each take is submitted. Shots that '
- 'continue the previous one carry one card picture per person (the sheet, else the front) for at most 3 people, '
- 'and keep the voices of the previous shot; POST /drama/plan shows each shot\'s cast. '
+ 'continue the previous one carry one card picture per person (a person alone: the sheet and a face close-up) for '
+ 'at most 3 people, and keep the voices of the previous shot; POST /drama/plan shows each shot\'s cast. '
+ 'A shot\'s own references replace the card pictures; references=[] sends none. '
'A shot with a carded character is at most 15 s; continue it in the next shot to go longer.',
'POST /cast/{id}/generate makes reference pictures from the description as a normal job (face=true adds a close-up). '
'It defaults to the installed image model, otherwise video frames (labels guessed, label_guess). '
diff --git a/freevideo_engine/comfy_assets.py b/freevideo_engine/comfy_assets.py
index 9bf3679..266d877 100644
--- a/freevideo_engine/comfy_assets.py
+++ b/freevideo_engine/comfy_assets.py
@@ -104,8 +104,8 @@ def resolve_assets(serialized, input_directory):
result.setdefault('references', []).append({'kind': kind, 'path': str(path)})
else:
raise ValueError('Media role must be first, last or reference')
- if result.get('references') and any(name in result for name in ('first', 'last')):
- raise ValueError('Use first/last frames or references in this request. Disable unused media cards.')
+ # Mixing keyframes and references is checked when the video is made (comfy_media.export):
+ # a part that continues a video uses its keyframes as pictures.
return result
@@ -151,9 +151,6 @@ def connect_assets(assets, *, first=None, last=None, reference=None, reference_a
if count > 32:
raise ValueError(f'There are {count} references and the limit is 32. '
'For a long image batch, connect a clip to the Reference node\'s video input; a clip counts as one reference.')
- if count and any(
- name in result or name in connected for name in ('first', 'last')):
- raise ValueError('Choose keyframes or references; disable the unused inputs')
if connected:
result['_connected'] = connected
return result
diff --git a/freevideo_engine/comfy_media.py b/freevideo_engine/comfy_media.py
index ac37d2b..6441c9e 100644
--- a/freevideo_engine/comfy_media.py
+++ b/freevideo_engine/comfy_media.py
@@ -44,23 +44,48 @@ def _audio(value, path):
container.mux(packet)
-def continued(exported):
- """What a continued part keeps of exported inputs: the pictures (at most three, one per person) and LoRAs.
+def continued(exported, notes=None):
+ """What a continued part keeps of exported inputs: up to three pictures, and the LoRAs.
- It starts from the footage, so keyframes, pre-encoded conditioning, clips and sound are left out."""
+ It starts from the footage, so a first or last frame image becomes one more picture after the
+ reference pictures; pre-encoded conditioning, clips and sound are left out. When keyframes are
+ used or pictures are left out, notes gets one line saying so."""
from .continuation import PICTURES_MAX
media = (exported or {}).get('media') or {}
kept = {key: value for key, value in media.items()
if key not in ('first', 'last', 'references', 'conditioning_info')}
pictures = [row for row in media.get('references', []) if row.get('kind') == 'image']
- if len(pictures) > PICTURES_MAX:
- logging.warning('[FreeVideo] A continued part keeps the first %d of %d pictures', PICTURES_MAX, len(pictures))
- if pictures:
- kept['references'] = pictures[:PICTURES_MAX]
+ keyframes = [name for name in ('first', 'last') if media.get(name)]
+ candidates = pictures + [{'kind': 'image', 'path': media[name]} for name in keyframes]
+ if candidates:
+ kept['references'] = candidates[:PICTURES_MAX]
+ lines = [continued_note(len(pictures), keyframes, len(candidates[:PICTURES_MAX]))]
+ if any(row.get('kind') != 'image' for row in media.get('references', [])) or media.get('conditioning_info') \
+ or (exported or {}).get('conditioning'):
+ lines.append('Video and audio references and pre-encoded conditioning are not used for a continued part.')
+ for line in filter(None, lines):
+ logging.info('[FreeVideo] %s', line)
+ if notes is not None:
+ notes.append(line)
return {'media': kept} if len(kept) > 1 else {}
-def export(run, canvas, *, first=None, last=None, references=None, loras=None, conditioning=None, assets=None):
+def continued_note(pictures, keyframes, used):
+ """One line for a continued part whose keyframes became pictures or whose pictures did not all fit."""
+ frames = ' and '.join(keyframes)
+ if pictures + len(keyframes) > used:
+ order = 'reference pictures first, then the %s frame image%s' % (frames, 's' if len(keyframes) > 1 else '')
+ return ('Continuing the previous video with %d of %d pictures: %s.' % (used, pictures + len(keyframes), order)
+ if keyframes else 'Continuing the previous video with the first %d of %d reference pictures.' % (used, pictures))
+ if keyframes:
+ return ('Continuing the previous video; the %s frame image%s used as %s.'
+ % (frames, 's are' if len(keyframes) > 1 else ' is', 'reference pictures' if len(keyframes) > 1 else 'a reference picture'))
+ return None
+
+
+def export(run, canvas, *, first=None, last=None, references=None, loras=None, conditioning=None, assets=None,
+ continuing=False):
+ """continuing: the request continues a video, so keyframes and references may be mixed (see continued)."""
media = {'version': 1}
if assets:
if conditioning is not None or first is not None or last is not None or references:
@@ -80,7 +105,8 @@ def export(run, canvas, *, first=None, last=None, references=None, loras=None, c
references.append({'kind': 'audio', 'value': connected['reference_audio']})
if conditioning is not None and (first is not None or last is not None or references):
raise ValueError('Preencoded conditioning already includes media; do not connect a second set')
- if references and (first is not None or last is not None):
+ keyframes = first is not None or last is not None or any(name in media for name in ('first', 'last'))
+ if not continuing and keyframes and (references or media.get('references')):
raise ValueError('Choose keyframes or experimental references; mixed layouts are not supported')
result = {}
run = Path(run)
diff --git a/freevideo_engine/comfy_nodes.py b/freevideo_engine/comfy_nodes.py
index 289a43f..a2a28cd 100644
--- a/freevideo_engine/comfy_nodes.py
+++ b/freevideo_engine/comfy_nodes.py
@@ -75,31 +75,31 @@ class FreeVideoGenerate(io.ComfyNode):
)
@classmethod
- def validate_inputs(cls, text, width, height, seconds, seed, **kwargs):
- refine_from = optional_text(kwargs.get('refine_from'))
+ def validate_inputs(cls, text, width, height, seconds, seed, continue_from='', frames=0, two_pass=True,
+ preview=False, refine_from='', base_steps=8, refine_steps=3):
+ # ComfyUI marks every input named here when a check fails, so only the checked widgets are
+ # listed. Linked pictures, media and conditioning have no value before the run anyway.
+ refine_from = optional_text(refine_from)
try:
- options = request_options(kwargs.get('continue_from', ''), kwargs.get('frames', 0))
+ options = request_options(continue_from, frames)
if options.get('continue_from'):
- # Use presence checks: tensor inputs have no scalar truth value.
- assets = kwargs.get('media')
- connected = assets.get('_connected', {}) if isinstance(assets, dict) else {}
- # References are not checked here: a continued part keeps only their pictures.
- media = dict(first=kwargs.get('first') is not None or connected.get('first') is not None,
- last=kwargs.get('last') is not None or connected.get('last') is not None,
- conditioning_info=kwargs.get('conditioning') is not None)
- if isinstance(assets, dict):
- for key in ('first', 'last', 'conditioning_info'):
- media[key] = media[key] or bool(assets.get(key))
- options.update(two_pass=kwargs.get('two_pass', True), preview=kwargs.get('preview', False),
- refine_from=refine_from or None, media=media)
+ # A continued part turns on two passes, skips the preview and takes keyframes as pictures (execute).
+ two_pass, preview = True, False
+ options.update(two_pass=True, preview=False, refine_from=refine_from or None,
+ media=dict(first=False, last=False, conditioning_info=False))
comfy_bridge.validate_request(text, width, height, seconds, seed, **options)
if not refine_from:
from .two_pass import validate_steps
- validate_steps(kwargs.get('base_steps', 8), kwargs.get('refine_steps', 3), kwargs.get('two_pass', True))
- if kwargs.get('preview') and not kwargs.get('two_pass', True):
+ validate_steps(base_steps, refine_steps, two_pass)
+ if preview and not two_pass:
return 'Preview first needs two-pass acceleration.'
comfy_bridge.installation()
except (OSError, ValueError, KeyError) as error:
+ from .continuation import UNSUPPORTED
+ if str(error).startswith(UNSUPPORTED):
+ # A refusal of the whole route (device, refine) is not one input's fault: the run stops
+ # at this node with the same guidance instead of marking every widget.
+ return True
return str(error)
return True
@@ -120,6 +120,13 @@ class FreeVideoGenerate(io.ComfyNode):
node_id = cls.hidden.unique_id
chain = block_context(PromptServer.instance, node_id)
options = request_options(continue_from, frames)
+ notes = []
+ if options.get('continue_from') and not two_pass:
+ two_pass = True
+ notes.append('Continuing a video uses two-pass acceleration, so it is on for this part.')
+ if options.get('continue_from') and preview:
+ preview = False
+ notes.append('A continued part is made in full, without stopping for a first-pass preview.')
from .two_pass import validate_steps
if not refine_from:
validate_steps(base_steps, refine_steps, two_pass)
@@ -167,6 +174,8 @@ class FreeVideoGenerate(io.ComfyNode):
logging.warning('[FreeVideo] %s', notice)
PromptServer.instance.send_progress_text(notice, node_id)
notice = notice + '\n' if notice else ''
+ def said():
+ return notice + ''.join(line + '\n' for line in notes)
def progress(message):
if message.get('report_id'):
result_report[0] = message['report_id']
@@ -184,7 +193,7 @@ class FreeVideoGenerate(io.ComfyNode):
publish(server, node_id, message)
if server is not None:
detail = message.get('detail')
- server.send_progress_text(notice + label + (' · ' + detail if detail else ''), node_id)
+ server.send_progress_text(said() + label + (' · ' + detail if detail else ''), node_id)
last_message[0] = dict(message)
def release():
cpu_prewarm = IDLE.stop()
@@ -212,6 +221,19 @@ class FreeVideoGenerate(io.ComfyNode):
# workflow, not one that points at this machine's preview file.
graph = comfy_bridge.without_upscale(graph, node_id, refine_from)
output_root = Path(folder_paths.get_output_directory()).resolve()
+
+ def kept(exported):
+ if not options.get('continue_from'):
+ return exported
+ before = len(notes)
+ result = continued(exported, notes)
+ if len(notes) > before and PromptServer.instance is not None:
+ PromptServer.instance.send_progress_text(said().rstrip('\n'), node_id)
+ return result
+ for line in notes:
+ logging.info('[FreeVideo] %s', line)
+ if notes and PromptServer.instance is not None:
+ PromptServer.instance.send_progress_text(said().rstrip('\n'), node_id)
publish(PromptServer.instance, node_id, {'label': 'Preparing video', 'new_request': True})
try:
output = comfy_bridge.generate(text, width, height, seconds, seed, output_root,
@@ -221,9 +243,8 @@ class FreeVideoGenerate(io.ComfyNode):
base_steps=base_steps, refine_steps=refine_steps, comfy_metadata=graph,
preview=bool(preview), refine_from=refine_from or None,
interrupted=memory.throw_exception_if_processing_interrupted, release_models=release,
- export_inputs=lambda run, canvas: (continued if options.get('continue_from') else dict)(
- export(run, canvas, first=first, last=last, references=references, loras=loras,
- conditioning=conditioning, assets=media)),
+ export_inputs=lambda run, canvas: kept(export(run, canvas, first=first, last=last, references=references,
+ loras=loras, conditioning=conditioning, assets=media, continuing=bool(options.get('continue_from')))),
**options,
# Only a part that continues another can use it; other requests keep the existing bridge call.
**({'first_frame_reference': True} if first_frame_reference is True and options.get('continue_from') else {}),
diff --git a/freevideo_engine/continuation.py b/freevideo_engine/continuation.py
index 4e1d26a..b6ea6ab 100644
--- a/freevideo_engine/continuation.py
+++ b/freevideo_engine/continuation.py
@@ -32,7 +32,13 @@ VERSION = 1
MISSING = 'The previous video has no usable continuation data. Generate it again with this version of FreeVideo.'
SIZE_MISMATCH = 'Use the same width and height as the previous video.'
-UNSUPPORTED = 'Video continuation requires full two-pass text generation on an NVIDIA GPU, without first frames, last frames or reference media.'
+# Every refusal starts with UNSUPPORTED, then says what to change.
+UNSUPPORTED = 'Continue from video cannot be used with these settings.'
+UNSUPPORTED_DEVICE = UNSUPPORTED + ' It needs an NVIDIA GPU. Clear Continue from video to make a new video.'
+UNSUPPORTED_PASSES = UNSUPPORTED + ' Turn on Two-pass acceleration and turn off Two-pass: preview first pass.'
+UNSUPPORTED_REFINE = UNSUPPORTED + ' Clear Second pass of preview: a continued part is made in full.'
+UNSUPPORTED_MEDIA = (UNSUPPORTED + ' A continued part takes up to 3 pictures as references. '
+ 'Remove video or audio references and pre-encoded conditioning.')
# A continued part keeps the cast's pictures, one per person and at most three people in a frame.
PICTURES_MAX = 3
INVALID_FRAMES = 'Frame count must be 5 + 17n and at least 39 (39, 56, 73, 90, ...).'
@@ -85,11 +91,16 @@ def validate_route(*, task='t2va', two_pass=True, preview=False, refine_from=Non
valid_task = task == ('ref2va' if anchor else 't2va')
if sound:
valid_task = valid_reference and task in (('ref2va', 'ref2va_av') if anchor else ('t2va', 'ref2va', 'ref2va_audio'))
- if (not supported()[0] or backend not in (None, 'cuda') or not valid_task
- or not two_pass or preview or refine_from
- or any(media.get(key) for key in ('first', 'last', 'conditioning_info'))
+ if not supported()[0] or backend not in (None, 'cuda'):
+ raise ValueError(UNSUPPORTED_DEVICE)
+ if refine_from:
+ raise ValueError(UNSUPPORTED_REFINE)
+ if not two_pass or preview:
+ raise ValueError(UNSUPPORTED_PASSES)
+ # Keyframes reach a continued part as pictures (comfy_media.continued); here they are a request error.
+ if (not valid_task or any(media.get(key) for key in ('first', 'last', 'conditioning_info'))
or (references and not valid_reference)):
- raise ValueError(UNSUPPORTED)
+ raise ValueError(UNSUPPORTED_MEDIA)
def encoded_references(conditions, task, anchor):
@@ -108,7 +119,7 @@ def continuation_pictures(media):
references = media.get('references') or []
pictures = [row for row in references if row.get('kind') == 'image']
if len(pictures) != len(references) or len(pictures) > PICTURES_MAX:
- raise ValueError(UNSUPPORTED)
+ raise ValueError(UNSUPPORTED_MEDIA)
return pictures
diff --git a/freevideo_engine/failure_details.py b/freevideo_engine/failure_details.py
index ab0a64e..edbc24d 100644
--- a/freevideo_engine/failure_details.py
+++ b/freevideo_engine/failure_details.py
@@ -446,10 +446,18 @@ def launcher_failure(value, *, zh=False, other_disk=False, disk_name='', can_rep
('Choose a supported frame count', '请选择支持的帧数'),
('Use 39, 56, 73, 90, or another value reached by adding 17. This includes the 22 repeated frames when continuing a video.',
'请使用 39、56、73、90 等每次增加 17 的帧数;接续时,这个数包含开头重复的 22 帧。')),
- (r'Video continuation requires full two-pass text generation', 'continuation-route',
- ('This generation mode cannot continue a video', '当前生成方式不支持视频接续'),
- ('Use full two-pass text generation on an NVIDIA GPU and remove first frames, last frames and reference media. Mac and preview generation are not supported.',
- '请在 NVIDIA 显卡上使用完整的文字生成两遍流程,移除首帧、尾帧和参考素材。Mac 和预览生成暂不支持接续。')),
+ (r'Continue from video cannot be used with these settings\. It needs an NVIDIA GPU', 'continuation-route',
+ ('This computer cannot continue a video', '这台电脑不支持视频接续'),
+ ('Continuing a video needs an NVIDIA GPU. Clear Continue from video to make a new video.', '视频接续需要 NVIDIA 显卡。要生成新视频,请清空 Continue from video。')),
+ (r'Continue from video cannot be used with these settings\. Turn on Two-pass', 'continuation-passes',
+ ('Continuing needs the full two passes', '接续需要完整的两遍生成'),
+ ('Turn on Two-pass acceleration and turn off Two-pass: preview first pass.', '请打开“二次采样加速”,并关闭一采预览。')),
+ (r'Continue from video cannot be used with these settings\. Clear Second pass', 'continuation-refine',
+ ('Continuing makes the whole part', '接续会完整生成这一段'),
+ ('Clear Second pass of preview, or clear Continue from video.', '请清空 Second pass of preview,或清空 Continue from video。')),
+ (r'Continue from video cannot be used with these settings\. A continued part takes', 'continuation-media',
+ ('A continued part takes pictures only', '接续段只能带图片参考'),
+ ('Connect up to 3 pictures as references. Remove video or audio references and pre-encoded conditioning.', '请把最多 3 张图片作为参考图接入,移除视频或音频参考以及预编码条件。')),
(r'Choose an existing MP4 video using its absolute path', 'continuation-file',
('Choose the previous video', '请选择上一段视频'),
('Select an existing MP4 video generated by FreeVideo. In ComfyUI, keep it inside the output or input folder.',
diff --git a/freevideo_engine/runtime.py b/freevideo_engine/runtime.py
index ea2a00f..b92bee5 100644
--- a/freevideo_engine/runtime.py
+++ b/freevideo_engine/runtime.py
@@ -632,8 +632,8 @@ class Engine:
else:
prompt, tags, conditions = load_prompt(str(conditioning), self.device_backend.device)
if continuation is not None and conditions:
- from .continuation import UNSUPPORTED
- raise ValueError(UNSUPPORTED)
+ from .continuation import UNSUPPORTED_MEDIA
+ raise ValueError(UNSUPPORTED_MEDIA)
from .keyframes import validate_conditioning
source_canvas = self.canvas if allow_smaller_canvas and self.canvas is not None else canvas
validate_conditioning(prompt, tags, conditions, self.task,
diff --git a/freevideo_engine/worker.py b/freevideo_engine/worker.py
index 0e509a6..b79bbaf 100644
--- a/freevideo_engine/worker.py
+++ b/freevideo_engine/worker.py
@@ -101,7 +101,7 @@ def generate(request, resident=None):
metrics['sampling_plan'] = expected
continuation = request.get('continuation')
if continuation is not None:
- from .continuation import (validate_route, summary, ADALN_TASK, ANCHOR_ADALN_TASK, UNSUPPORTED,
+ from .continuation import (validate_route, summary, ADALN_TASK, ANCHOR_ADALN_TASK, UNSUPPORTED_DEVICE,
validate_audio_context, AUDIO_CONTEXT_DEFAULT)
# A plan that fell back to one pass on a small canvas still has
# the two-pass flag set and keeps its continuation; an explicit
@@ -113,7 +113,7 @@ def generate(request, resident=None):
two_pass=bool(request.get('sampling_plan', {}).get('requested')),
preview=request.get('preview', False), refine_from=request.get('resume_first_pass'))
if isinstance(getattr(torch.version, 'hip', None), str):
- raise ValueError(UNSUPPORTED)
+ raise ValueError(UNSUPPORTED_DEVICE)
continuation = dict(continuation,
audio_context=validate_audio_context(continuation.get('audio_context', AUDIO_CONTEXT_DEFAULT)))
request['continuation'] = continuation
diff --git a/web/error_panel.js b/web/error_panel.js
index c29e5ac..1161a4a 100644
--- a/web/error_panel.js
+++ b/web/error_panel.js
@@ -21,9 +21,18 @@ const PLAIN_ERRORS = [
{key: 'continuation-size', message: 'Use the same width and height as the previous video.',
title: ['The video sizes differ', '两段视频的画面大小不一致'],
summary: ['Set the width and height to the previous video’s size.', '请把宽度和高度设为与上一段视频相同。']},
- {key: 'continuation-route', message: 'Video continuation requires full two-pass text generation on an NVIDIA GPU, without first frames, last frames or reference media.',
- title: ['This generation mode cannot continue a video', '当前生成方式不支持视频接续'],
- summary: ['Use full two-pass text generation on an NVIDIA GPU and remove first frames, last frames and reference media. Mac and preview generation are not supported.', '请在 NVIDIA 显卡上使用完整的文字生成两遍流程,移除首帧、尾帧和参考素材。Mac 和预览生成暂不支持接续。']},
+ {key: 'continuation-route', message: 'Continue from video cannot be used with these settings. It needs an NVIDIA GPU. Clear Continue from video to make a new video.',
+ title: ['This computer cannot continue a video', '这台电脑不支持视频接续'],
+ summary: ['Continuing a video needs an NVIDIA GPU. Clear Continue from video to make a new video.', '视频接续需要 NVIDIA 显卡。要生成新视频,请清空 Continue from video。']},
+ {key: 'continuation-passes', message: 'Continue from video cannot be used with these settings. Turn on Two-pass acceleration and turn off Two-pass: preview first pass.',
+ title: ['Continuing needs the full two passes', '接续需要完整的两遍生成'],
+ summary: ['Turn on Two-pass acceleration and turn off Two-pass: preview first pass.', '请打开“二次采样加速”,并关闭一采预览。']},
+ {key: 'continuation-refine', message: 'Continue from video cannot be used with these settings. Clear Second pass of preview: a continued part is made in full.',
+ title: ['Continuing makes the whole part', '接续会完整生成这一段'],
+ summary: ['Clear Second pass of preview, or clear Continue from video.', '请清空 Second pass of preview,或清空 Continue from video。']},
+ {key: 'continuation-media', message: 'Continue from video cannot be used with these settings. A continued part takes up to 3 pictures as references. Remove video or audio references and pre-encoded conditioning.',
+ title: ['A continued part takes pictures only', '接续段只能带图片参考'],
+ summary: ['Connect up to 3 pictures as references. Remove video or audio references and pre-encoded conditioning.', '请把最多 3 张图片作为参考图接入,移除视频或音频参考以及预编码条件。']},
{key: 'continuation-frames', message: 'Frame count must be 5 + 17n and at least 39 (39, 56, 73, 90, ...).',
aliases: ['Frames must be 0 to use Duration, or 5 + 17n and at least 39 (for example, 39, 56, 141 or 243). The total includes 22 overlap frames when continuing.'],
title: ['Choose a supported frame count', '请选择支持的帧数'],
diff --git a/web/freevideo.js b/web/freevideo.js
index 95c77bb..071ab69 100644
--- a/web/freevideo.js
+++ b/web/freevideo.js
@@ -242,6 +242,11 @@ function mediaPanel(node, mount = null) {
try { rows = read(); } catch (error) { message(error.message, true); return; }
const active = rows.filter(row => row.enabled !== false);
const linked = name => node.inputs?.find(i => i.name === name)?.link != null;
+ // A Generate node that continues a video takes these keyframes as pictures, so they may sit beside references.
+ const continuing = (node.outputs?.[0]?.links || []).some(id => {
+ const target = node.graph?.getNodeById(node.graph?.links[id]?.target_id);
+ return target?.type === 'FreeVideoGenerate' && String(target.widgets?.find(w => w.name === 'continue_from')?.value ?? '').trim();
+ });
const first = active.filter(row => row.role === "first").length + Number(linked('first'));
const last = active.filter(row => row.role === "last").length + Number(linked('last'));
const audioRefs = active.filter(row => row.role === 'reference' && mediaKind(row.file) === 'audio').length + Number(linked('reference_audio'));
@@ -258,7 +263,7 @@ function mediaPanel(node, mount = null) {
chip.title = source?.title || source?.type || label; connections.append(chip);
}
mode.textContent = refs ? text("Reference video · experimental", "参考生成 · 实验性") : first && last ? text("First + last frame", "首尾帧生成") : first ? text("Image to video", "图生视频") : last ? text("Last frame to video", "尾帧生成") : text("Text to video · media is optional", "文生视频 · 素材可留空");
- message(refs > 32 ? text(`There are ${refs} references and the limit is 32. Remove some before generating.`, `参考素材有 ${refs} 个,超过了 32 个的上限,请减少后再生成。`) : refs && (first || last) ? text("Choose keyframes or references. Disable unused cards.", "首尾帧与参考模式不能混用,请关闭本次不用的素材。") : first > 1 || last > 1 ? text("Keep only one first frame and one last frame enabled.", "首帧和尾帧各只能启用一张图片。") : text("Connect IMAGE / AUDIO outputs on the left, or drop / paste files here.", "可连接左侧 IMAGE / AUDIO 输入,或拖入、粘贴文件。"), Boolean(refs > 32 || refs && (first || last) || first > 1 || last > 1));
+ message(refs > 32 ? text(`There are ${refs} references and the limit is 32. Remove some before generating.`, `参考素材有 ${refs} 个,超过了 32 个的上限,请减少后再生成。`) : (first || last) && continuing ? text("Continuing a video: first and last frame images are used as reference pictures.", "接续视频时,首尾帧图会作为参考图使用。") : refs && (first || last) ? text("Choose keyframes or references. Disable unused cards.", "首尾帧与参考模式不能混用,请关闭本次不用的素材。") : first > 1 || last > 1 ? text("Keep only one first frame and one last frame enabled.", "首帧和尾帧各只能启用一张图片。") : text("Connect IMAGE / AUDIO outputs on the left, or drop / paste files here.", "可连接左侧 IMAGE / AUDIO 输入,或拖入、粘贴文件。"), Boolean(refs > 32 || refs && (first || last) && !continuing || first > 1 || last > 1));
if (!rows.length && !connections.childElementCount) cards.append(el("div", text("Leave empty for text to video.", "留空则为文生视频。"), "fv-empty"));
if (!rows.length && connections.childElementCount) cards.append(el('div', text('Media will come from the connected nodes.\nNo upload is needed.', '素材由已连接的节点提供。\n无需上传文件。'), 'fv-connected-card'));
rows.forEach((row, index) => {