Commit
·
08f6d0e
1
Parent(s):
1755abc
foo
Browse files- .gitignore +2 -0
- frames.py +15 -0
.gitignore
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
.idea
|
2 |
+
output
|
frames.py
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import cv2
|
2 |
+
import os
|
3 |
+
def extract_frames(url_path,output_dir):
|
4 |
+
os.makedirs(output_dir, exist_ok=True)
|
5 |
+
frame_count=0
|
6 |
+
cap=cv2.VideoCapture(url_path)
|
7 |
+
while cap.isOpened() and frame_count<10:
|
8 |
+
ret,frame=cap.read()
|
9 |
+
if not ret:
|
10 |
+
break
|
11 |
+
frame_name=f"{frame_count}.png"
|
12 |
+
cv2.imwrite(os.path.join(output_dir, frame_name), frame)
|
13 |
+
frame_count+=1
|
14 |
+
cap.release()
|
15 |
+
extract_frames("C:/Users/BRIDGES/Downloads/Video1.mp4","output")
|