fix(annotate): tolerate decoder returning fewer frames than requested

pyav (and sometimes torchcodec) decode can return fewer frames than
requested timestamps when some timestamps fall outside the video file's
content range. Drop the strict=True on the zip and rely on the
None-filter to discard missing frames.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Pepijn
2026-04-28 14:21:38 +02:00
parent 01fc975eb5
commit 23845218b6
@@ -109,7 +109,10 @@ class VideoFrameProvider:
if misses:
decoded = self._decode(record.episode_index, misses)
for i, img in zip(miss_indices, decoded, strict=True):
# decoder may return fewer frames than requested when some
# timestamps fall outside the video; pair what we have and
# leave the rest as None to be filtered below.
for i, img in zip(miss_indices, decoded):
out[i] = img
key = (record.episode_index, round(float(timestamps[i]), 6))
if len(self._cache) >= self.cache_size: