Open
Description
How to use similar functions in cv2:: codacodec:: VdieoReader like cv2:: VideoCapture:: set (CAP_PROP_POS_FRAMES, target)
I need to read the video frame from the customized key frame position, or repeat the reading from the specified frame when reading the video to the last frame
just like
def get_cap_frames_by_range(f_cap, frames_idx, prepared_f_frames):
min_index, max_index = min(frames_idx), max(frames_idx)
# print(min_index, max_index)
temp_counter = {}
temp_frames = {}
for item in frames_idx:
if item not in temp_counter:
temp_counter[item] = 0
temp_counter[item] += 1
if int(f_cap.get(cv2.CAP_PROP_POS_FRAMES)) != min_index:
# print("switch CAP_PROP_POS_FRAMES")
f_cap.set(cv2.CAP_PROP_POS_FRAMES, min_index)
...