Improvement of how we determine the initial timestamp.

This commit is contained in:
Frédéric Tronel
2025-10-23 11:12:20 +02:00
parent 1e6167a1ae
commit 4f9c3ea08b

View File

@@ -154,8 +154,9 @@ def getInitialTSFromBuffer(content, delta=0.1):
logger = logging.getLogger(__name__)
logger.debug('Determining initial timestamp from content')
length = len(content)
with Popen(['ffprobe','/dev/stdin','-loglevel', 'quiet', '-read_intervals', ('0%%+%f' % delta), '-show_entries', 'frame=frame_no,best_effort_timestamp_time', '-of','json'], stdout=PIPE, stdin=PIPE) as ffprobe:
out, _ = ffprobe.communicate(input=content)
out, _ = ffprobe.communicate(input=content[0:min(length,200000)])
frames = json.load(BytesIO(out))
logger.debug('Frames: %s' % frames)
if 'frames' in frames: