Created
May 10, 2021 12:16
-
-
Save aliyevorkhan/f51e15b935e4c9915c27df649255d14d 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
import cv2 | |
import sys | |
import uuid | |
from tqdm import tqdm | |
video_name = str(sys.argv[1]) | |
e_rate = int(sys.argv[2]) | |
cap = cv2.VideoCapture(video_name+'.mp4') | |
frame_count = int(cap.get(cv2.CAP_PROP_FRAME_COUNT)) | |
count=0 | |
pbar = tqdm(total=frame_count,desc ="Extracting") | |
while True: | |
ret, frame = cap.read() | |
if not ret: | |
break | |
pbar.update(1) | |
if count%e_rate==0: | |
cv2.imwrite('orkhan_hand/'+str(uuid.uuid4())+'.jpg', frame) | |
count+=1 | |
pbar.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
simple usage: python3 extract_frame_tqdm.py video_name 5