diff --git a/anime_audio_helper.py b/anime_audio_helper.py index e6115e9..a76fdbb 100755 --- a/anime_audio_helper.py +++ b/anime_audio_helper.py @@ -301,6 +301,7 @@ def _snap_to_known_ar_cropdetect(w, h, x, y, video_w, video_h, tolerance=0.03): new_y = round((video_h - new_h) / 2) if new_y % 2 != 0: new_y -= 1 + new_y = max(0, new_y) return f"crop={video_w}:{new_h}:0:{new_y}", best_match['name'] if abs(h - video_h) < 16: new_w = round(video_h * best_match['ratio']) @@ -309,6 +310,7 @@ def _snap_to_known_ar_cropdetect(w, h, x, y, video_w, video_h, tolerance=0.03): new_x = round((video_w - new_w) / 2) if new_x % 2 != 0: new_x -= 1 + new_x = max(0, new_x) return f"crop={new_w}:{video_h}:{new_x}:0", best_match['name'] return f"crop={w}:{h}:{x}:{y}", None