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.

Keep the guide clip's sound on a preview too when requested

Bowen Xue2a4754c73a02
diff --git a/freevideo_engine/generate.py b/freevideo_engine/generate.py
index dbc8452..3a97b5a 100644
--- a/freevideo_engine/generate.py
+++ b/freevideo_engine/generate.py
@@ -1254,8 +1254,9 @@ def _run(args):
shutil.copyfile(destination.with_suffix('.engine.json'), artifacts / 'first-pass.engine.json')
from .preview import upscale_reads
report['preview']['upscale_reads'] = upscale_reads(request['cache'], report['video'], upscaler_checkpoint)
- if not preview and any(row.get('keep_source_audio') for row in media.get('references', [])):
- from .guide_audio import apply_to_report as keep_source_audio
+ from .guide_audio import apply_to_report as keep_source_audio, requested as keeps_source_audio
+ if keeps_source_audio(media):
+ # A preview gets the guide clip's sound too; its upscale reads the retained first pass, not this MP4.
keep_source_audio(destination, media, report)
report['success'] = True
except BaseException as error:
diff --git a/freevideo_engine/guide_audio.py b/freevideo_engine/guide_audio.py
index 4633534..e8bab46 100644
--- a/freevideo_engine/guide_audio.py
+++ b/freevideo_engine/guide_audio.py
@@ -80,6 +80,11 @@ def replace_audio(video, guide, output, *, rate=48000, layout='stereo'):
return seconds
+def requested(media):
+ """True when the request asks to keep a guide clip's own audio (a preview included)."""
+ return any(row.get('guide') and row.get('keep_source_audio') for row in media.get('references', []))
+
+
def apply(video, media):
"""Replace ``video`` in place when the request's guide asks to keep its audio. Returns True if replaced."""
guide = next((row for row in media.get('references', []) if row.get('guide') and row.get('keep_source_audio')), None)