Skip to content

Instantly share code, notes, and snippets.

@Fitzy1293
Created October 10, 2020 03:56
Show Gist options
  • Save Fitzy1293/ea0c0e431298c4b82b57c7aa73bc672e to your computer and use it in GitHub Desktop.
Save Fitzy1293/ea0c0e431298c4b82b57c7aa73bc672e to your computer and use it in GitHub Desktop.
#!/bin/env python3
import cv2
import os
vidcap = cv2.VideoCapture('norm.mp4')
success, image = vidcap.read()
dir = os.getcwd()
count = 0
while success:
fname = os.path.join(dir, 'frames', f'{count}.jpg')
print(fname)
cv2.imwrite(fname, image)
success,image = vidcap.read()
print('Read a new frame: ', success)
count += 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment