Created
May 5, 2020 19:47
-
-
Save YatinAdityaT/4fb438cb0549d5707eac2fd648a063da to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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