fix: guard against floating-point precision error in video subclip end_time MoviePy raises ValueErr
This commit is contained in:
@@ -2714,6 +2714,10 @@ def download_and_crop_video(video_url, output_path):
|
||||
return None
|
||||
|
||||
end_time = min(VIDEO_MAX_DURATION_SECONDS, duration)
|
||||
# Guard against floating-point precision errors where end_time == duration
|
||||
# causes MoviePy to reject the subclip as out of bounds
|
||||
end_time = min(end_time, duration - 0.05)
|
||||
end_time = max(end_time, 0.1) # safety: never go negative or zero
|
||||
|
||||
video_clip = VideoFileClip(temp_input)
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user