Add fallback to format duration and debug logging for VideoSource

This commit is contained in:
giles
2026-02-03 00:36:36 +00:00
parent a57be27907
commit 82599eff1e

View File

@@ -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: