fix: ffmpeg command type hint, -ss comment, FileNotFoundError handler

This commit is contained in:
2026-04-06 12:08:42 +02:00
parent f6832f58a6
commit 8a97c3c7c2
2 changed files with 6 additions and 1 deletions
+5 -1
View File
@@ -16,7 +16,9 @@ def format_time(seconds: float) -> str:
return f"{m}:{s:04.1f}"
def build_ffmpeg_command(input_path: str, start: float, output_path: str) -> list:
def build_ffmpeg_command(input_path: str, start: float, output_path: str) -> list[str]:
# -ss before -i: fast input-seeking. Safe here because we always re-encode
# (libx264/aac), so there is no keyframe-alignment issue from pre-input seek.
return [
"ffmpeg", "-y",
"-ss", str(start),
@@ -46,6 +48,8 @@ class ExportWorker(QThread):
self.finished.emit(self._output)
else:
self.error.emit(result.stderr[-500:])
except FileNotFoundError:
self.error.emit("ffmpeg not found — is it installed and on PATH?")
except Exception as e:
self.error.emit(str(e))
+1
View File
@@ -26,6 +26,7 @@ def test_format_time_no_sixty_rollover():
def test_ffmpeg_command():
cmd = build_ffmpeg_command("/in/video.mp4", 12.5, "/out/clip_001.mp4")
assert cmd[0] == "ffmpeg"
assert "-y" in cmd
assert "-ss" in cmd
assert str(12.5) in cmd
assert "-t" in cmd