192 Frame Limit (Bug and Proposed Fix)
Author: pftqCreated Feb 22, 2025Updated Sep 4, 2026
I'm coming from debugging the SkyReels code and it seems to point at a bug in the Hunyuan VAE that hard limits the video at 192 frames (even if there is good output going beyond that, it just gets thrown out).
In autoencoder_kl_hunyuan_video.py. The original code runs into an out-of-bounds at the 25th tile (193rd frame at 8 frames per tile), which then causes the video to loop from 193 onwards instead of using the correct frames.
Find:
for i in range(0, num_frames, tile_latent_stride_num_frames):
tile = z[:, :, i : i + tile_latent_min_num_frames + 1, :, :]Replace:
for i in range(0, num_frames, tile_latent_stride_num_frames):
end_idx = min(i + tile_latent_min_num_frames + 1, num_frames)
tile = z[:, :, i : end_idx, :, :]
if i > 0:
tile = torch.cat([z[:, :, i - 1 : i, :, :], tile], dim=2) # 20250222 pftq: Add previous frame for continuityMaking this change should remove the hard limit but I'm not quite sure how to test and apply it.
Source: Tencent-Hunyuan/HunyuanVideo