From 69062205fd9c6d403b6e368ddf7ebfe0e0908e78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastjan=20Arti=C4=8D?= Date: Thu, 30 Apr 2026 12:01:06 +0000 Subject: [PATCH] Fix preview-clip ffmpeg: force even dimensions for libx264 Bug: 'width not divisible by 2 (853x480)' from screenshot. libx264 requires even width/height. scale=854:480 + decrease can result in 853x480 (odd width). Fix: chain second scale filter that truncates to nearest even number: scale=trunc(iw/2)*2:trunc(ih/2)*2 Verified locally: 4.4MB clip in 4.8s on CPU. --- app/main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/main.py b/app/main.py index 34278f1..88ac19b 100644 --- a/app/main.py +++ b/app/main.py @@ -1291,7 +1291,7 @@ async def preview_clip( "-i", str(src), "-ss", f"{min(0.5, start):.2f}", # fine seek "-t", f"{duration:.2f}", - "-vf", "scale=854:480:force_original_aspect_ratio=decrease", # 480p + "-vf", "scale=854:480:force_original_aspect_ratio=decrease,scale=trunc(iw/2)*2:trunc(ih/2)*2", # 480p, even dimensions for libx264 "-c:v", "libx264", "-preset", "ultrafast", # NAJHITREJŠI preset "-crf", "30", # nižja kvaliteta = hitrejše