diff --git a/twitter2bsky.py b/twitter2bsky.py index b6be625..a4c57be 100644 --- a/twitter2bsky.py +++ b/twitter2bsky.py @@ -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: