Skip to content

Instantly share code, notes, and snippets.

@ayush29feb
Created November 15, 2018 17:46
Show Gist options
  • Save ayush29feb/2d8eaa9161ee81d2a1a0bf67bbf0002e to your computer and use it in GitHub Desktop.
Save ayush29feb/2d8eaa9161ee81d2a1a0bf67bbf0002e to your computer and use it in GitHub Desktop.
Converting a video to photos
import cv2
vidcap = cv2.VideoCapture('/gdrive/<filepath>')
success,image = vidcap.read()
count = 0
success = True
while success:
success,image = vidcap.read()
cv2.imwrite("/gdrive/<filepath>" % count, image) # save frame as JPEG file
if cv2.waitKey(10) == 27: # exit if Escape is hit
break
count += 1
print (success)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment