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.

Record decoded audio level in the diagnostic report

Bowen Xueb91f58704aa1
diff --git a/freevideo_engine/decode.py b/freevideo_engine/decode.py
index 2c6d79f..7ed5a3e 100644
--- a/freevideo_engine/decode.py
+++ b/freevideo_engine/decode.py
@@ -227,6 +227,9 @@ def decode_to_file(latents, audio_latents, out_path, *, base, offload=False, pre
audio = audio[:, :round(kept_frames * 40 / 24) * 800]
if continuation is not None:
audio = audio[:, continuation['audio_latents'] * 800:]
+ audio_level = {'audio_rms': float(audio.square().mean().sqrt()) if audio.numel() else 0.,
+ 'audio_peak': float(audio.abs().max()) if audio.numel() else 0.,
+ 'audio_samples': int(audio.shape[-1])}
del audio_vae, audio_mean, audio_std
gc.collect()
torch.cuda.empty_cache()
@@ -269,6 +272,7 @@ def decode_to_file(latents, audio_latents, out_path, *, base, offload=False, pre
'vae_linear_compute_cache': linear_compute_cache, 'vae_compute_cache_preparation': compute_cache_metrics,
'resident_vae_cache_hit': vae_cache_hit, 'resident_audio_vae_cache_hit': audio_cache_hit,
'vae_preload_seconds': preload_seconds,
+ **audio_level,
'audio_load_decode_seconds': audio_seconds, 'encode_seconds': time.perf_counter() - encode_started,
'decoded_artifact_save_seconds': artifact_seconds,
'streamed_video_output': stream_output, 'streamed_vae_weights': stream_weights,
diff --git a/freevideo_engine/diagnostic_resources.py b/freevideo_engine/diagnostic_resources.py
index cf4ed69..6738492 100644
--- a/freevideo_engine/diagnostic_resources.py
+++ b/freevideo_engine/diagnostic_resources.py
@@ -243,7 +243,7 @@ def decoder_measurements(value):
result = numbers(value, ('vae_load_seconds', 'video_decode_seconds',
'audio_load_decode_seconds', 'video_postprocess_seconds', 'encode_seconds',
'decoded_artifact_save_seconds', 'decode_save_seconds', 'vae_resident_blocks',
- 'vae_pinned_weight_bytes'))
+ 'vae_pinned_weight_bytes', 'audio_rms', 'audio_peak', 'audio_samples'))
for key in ('vae_linear_compute_cache', 'resident_vae_cache_hit', 'resident_audio_vae_cache_hit',
'streamed_video_output', 'streamed_vae_weights'):
if type(value.get(key)) is bool: