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 a finished video when the guide audio remux fails

Bowen Xueb79aa97cae3e
diff --git a/freevideo_engine/generate.py b/freevideo_engine/generate.py
index 5b219b6..243ddce 100644
--- a/freevideo_engine/generate.py
+++ b/freevideo_engine/generate.py
@@ -1165,8 +1165,8 @@ def _run(args):
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 as keep_source_audio
- report['keep_source_audio'] = keep_source_audio(destination, media)
+ from .guide_audio import apply_to_report as keep_source_audio
+ keep_source_audio(destination, media, report)
report['success'] = True
except BaseException as error:
from .diagnostic_resources import exception_details
diff --git a/freevideo_engine/guide_audio.py b/freevideo_engine/guide_audio.py
index d70b6e9..4633534 100644
--- a/freevideo_engine/guide_audio.py
+++ b/freevideo_engine/guide_audio.py
@@ -93,3 +93,16 @@ def apply(video, media):
finally:
temporary.unlink(missing_ok=True)
return True
+
+
+def apply_to_report(video, media, report):
+ """Run ``apply`` after a successful generation; a failed remux leaves the finished video as it is.
+
+ The result is recorded in ``report``: ``keep_source_audio`` is True when the audio was replaced,
+ and ``keep_source_audio_failed`` holds a short reason when it could not be.
+ """
+ try:
+ report['keep_source_audio'] = apply(video, media)
+ except Exception as error: # the video is already complete and valid; only the audio swap failed
+ report['keep_source_audio'] = False
+ report['keep_source_audio_failed'] = ('%s: %s' % (type(error).__name__, error))[:300]