Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 3 additions & 17 deletions benchmarks/decoders/benchmark_decoders_library.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import abc
import json
import subprocess
import typing
import urllib.request
Expand All @@ -20,7 +19,6 @@
create_from_file,
get_frames_at_indices,
get_frames_by_pts,
get_json_metadata,
get_next_frame,
seek_to_pts,
)
Expand Down Expand Up @@ -238,11 +236,7 @@ def decode_frames(self, video_file, pts_list):
color_conversion_library=self._color_conversion_library,
device=self._device,
)
metadata = json.loads(get_json_metadata(decoder))
best_video_stream = metadata["bestVideoStreamIndex"]
frames, *_ = get_frames_by_pts(
decoder, stream_index=best_video_stream, timestamps=pts_list
)
frames, *_ = get_frames_by_pts(decoder, timestamps=pts_list)
return frames

def decode_first_n_frames(self, video_file, n):
Expand Down Expand Up @@ -356,11 +350,7 @@ def decode_frames(self, video_file, pts_list):
color_conversion_library=self._color_conversion_library,
device=self._device,
)
metadata = json.loads(get_json_metadata(decoder))
best_video_stream = metadata["bestVideoStreamIndex"]
frames, *_ = get_frames_by_pts(
decoder, stream_index=best_video_stream, timestamps=pts_list
)
frames, *_ = get_frames_by_pts(decoder, timestamps=pts_list)
return frames

def decode_first_n_frames(self, video_file, n):
Expand All @@ -371,12 +361,8 @@ def decode_first_n_frames(self, video_file, n):
color_conversion_library=self._color_conversion_library,
device=self._device,
)
metadata = json.loads(get_json_metadata(decoder))
best_video_stream = metadata["bestVideoStreamIndex"]
indices_list = list(range(n))
frames, *_ = get_frames_at_indices(
decoder, stream_index=best_video_stream, frame_indices=indices_list
)
frames, *_ = get_frames_at_indices(decoder, frame_indices=indices_list)
return frames


Expand Down
Loading