Commit 394d210 for stable-diffusion.cpp
commit 394d2104fc112b27e545c6b3f7ce09732426b5eb
Author: losewayy <losemywayy@gmail.com>
Date: Sat Nov 14 19:45:33 2026 +0800
fix: trim MiniMax-H3 audio to video duration (#2350)
diff --git a/src/pipeline/video.cpp b/src/pipeline/video.cpp
index 915dc54..ab64540 100644
--- a/src/pipeline/video.cpp
+++ b/src/pipeline/video.cpp
@@ -2287,12 +2287,12 @@ namespace sd::pipeline {
if (frames_out != nullptr) {
*frames_out = result;
}
- if (sd->version == VERSION_WAN2_2_S2V && generated_audio != nullptr) {
- // Limit the driving track to the generated video's duration.
+ if ((sd->version == VERSION_WAN2_2_S2V || sd_version_is_minimax_h3(sd->version)) && generated_audio != nullptr) {
+ // Limit the audio track to the generated video's duration.
int fps = request.fps;
uint64_t video_frames = num_frames_out != nullptr ? (uint64_t)*num_frames_out : 0;
uint64_t want_samples = (uint64_t)((double)video_frames / fps * generated_audio->sample_rate);
- LOG_DEBUG("s2v audio truncate: %llu samples -> %llu (video %llu frames @ %d fps)",
+ LOG_DEBUG("output audio truncate: %llu samples -> %llu (video %llu frames @ %d fps)",
(unsigned long long)generated_audio->sample_count,
(unsigned long long)want_samples,
(unsigned long long)video_frames,