From f6928421baed383c1d274771815ea41461b5b47d Mon Sep 17 00:00:00 2001 From: Ahmad Sharif Date: Thu, 7 Nov 2024 13:17:10 -0800 Subject: [PATCH] Handle videos with start stream > 0 --- benchmarks/decoders/benchmark_decoders_library.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/benchmarks/decoders/benchmark_decoders_library.py b/benchmarks/decoders/benchmark_decoders_library.py index f4be7d8e..84e20db9 100644 --- a/benchmarks/decoders/benchmark_decoders_library.py +++ b/benchmarks/decoders/benchmark_decoders_library.py @@ -494,7 +494,12 @@ def run_benchmarks( metadata_label = f"{metadata.codec} {metadata.width}x{metadata.height}, {metadata.duration_seconds}s {metadata.average_fps}fps" duration = metadata.duration_seconds - uniform_pts_list = [i * duration / num_samples for i in range(num_samples)] + # The epislon of 1e-6 is added to avoid floating point issues. Otherwise I see error messages like: + # RuntimeError: frame pts is 0.015999; must be in range [0.015999, 5.004316). + begin = metadata.begin_stream_seconds + 1e-6 + uniform_pts_list = [ + i * duration / num_samples + begin for i in range(num_samples) + ] # Note that we are using the same random pts values for all decoders for the same # video. However, because we use the duration as part of this calculation, we