From 82599eff1eeace06af9fabb429f8f378d473e7e6 Mon Sep 17 00:00:00 2001 From: giles Date: Tue, 3 Feb 2026 00:36:36 +0000 Subject: [PATCH] Add fallback to format duration and debug logging for VideoSource --- sexp_effects/primitive_libs/streaming.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/sexp_effects/primitive_libs/streaming.py b/sexp_effects/primitive_libs/streaming.py index 499c73f..2913b0f 100644 --- a/sexp_effects/primitive_libs/streaming.py +++ b/sexp_effects/primitive_libs/streaming.py @@ -46,9 +46,16 @@ class VideoSource: self._duration = int(h) * 3600 + int(m) * 60 + float(s) break + # Fallback: check format duration if stream duration not found + if self._duration is None and "format" in info and "duration" in info["format"]: + self._duration = float(info["format"]["duration"]) + if not self._frame_size: self._frame_size = (720, 720) + import sys + print(f"VideoSource: {self.path.name} duration={self._duration} size={self._frame_size}", file=sys.stderr) + def _start_stream(self, seek_time: float = 0): """Start or restart the ffmpeg streaming process.""" if self._proc: