diff --git a/src/pupil_labs/neon_recording/stream/av_stream/base_av_stream.py b/src/pupil_labs/neon_recording/stream/av_stream/base_av_stream.py index b018b45..f734f5e 100644 --- a/src/pupil_labs/neon_recording/stream/av_stream/base_av_stream.py +++ b/src/pupil_labs/neon_recording/stream/av_stream/base_av_stream.py @@ -95,6 +95,7 @@ def __init__(self, container, timestamps): self.container = container self.timestamps = timestamps self.current_frame = None + self.frame_idx = -1 def goto_index(self, frame_idx, frame_generator): video = self.container.streams.video[0] @@ -108,15 +109,9 @@ def goto_index(self, frame_idx, frame_generator): for _ in range(self.frame_idx, frame_idx): self.current_frame = next(frame_generator) - return self.current_frame - - @property - def frame_idx(self): - if self.current_frame is None: - return -1 + self.frame_idx = frame_idx - video = self.container.streams.video[0] - return int(self.current_frame.pts * video.time_base * video.average_rate) + return self.current_frame class BaseAVStream(StreamSampler):