Skip to content

Instantly share code, notes, and snippets.

@YatinAdityaT
Created May 5, 2020 19:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save YatinAdityaT/4fb438cb0549d5707eac2fd648a063da to your computer and use it in GitHub Desktop.
Save YatinAdityaT/4fb438cb0549d5707eac2fd648a063da to your computer and use it in GitHub Desktop.
PATH = 'Real Life Violence Dataset/Violence/V_10.mp4'
cap = cv2.VideoCapture(PATH)
fps = cap.get(cv2.CAP_PROP_FPS)
frame_count = cap.get(cv2.CAP_PROP_FRAME_COUNT)
duration = frame_count / fps
mid_point = frame_count//2
starting_point = mid_point-20
time_stamp = starting_point/fps
cap.set(cv2.CAP_PROP_POS_MSEC, time_stamp * 1000)
frame_count = 1
while (cap.isOpened()):
success, image = cap.read()
if success and frame_count <= 40:
frame_count += 1
else: break
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment