Skip to content

about how to use cv2:: codacodec:: VdieoReader::set() #3944

Open
@RookieDeng33

Description

@RookieDeng33

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)
      ...

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions