remade-effects / video_config.py
alex-remade's picture
working with progress bar
d948455
raw
history blame contribute delete
723 Bytes
# Frame rates for different model types
MODEL_FRAME_RATES = {
"wanvideo": 16, # WanVideo models use 16 fps
"hunyuan": 24 # Hunyuan models use 24 fps
}
def calculate_frames(duration, frame_rate):
"""
Calculate frames ensuring they follow the 4K+1 pattern
Args:
duration: Video duration in seconds
frame_rate: Frames per second
Returns:
int: Number of frames following 4K+1 pattern
"""
# Calculate raw frames
raw_frames = round(duration * frame_rate)
# Adjust to nearest 4K+1 value
# First, find the nearest multiple of 4
nearest_multiple_of_4 = round(raw_frames / 4) * 4
# Then add 1 to get 4K+1
return nearest_multiple_of_4 + 1