Add fallback to format duration and debug logging for VideoSource
This commit is contained in:
@@ -46,9 +46,16 @@ class VideoSource:
|
|||||||
self._duration = int(h) * 3600 + int(m) * 60 + float(s)
|
self._duration = int(h) * 3600 + int(m) * 60 + float(s)
|
||||||
break
|
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:
|
if not self._frame_size:
|
||||||
self._frame_size = (720, 720)
|
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):
|
def _start_stream(self, seek_time: float = 0):
|
||||||
"""Start or restart the ffmpeg streaming process."""
|
"""Start or restart the ffmpeg streaming process."""
|
||||||
if self._proc:
|
if self._proc:
|
||||||
|
|||||||
Reference in New Issue
Block a user