Skip to content

Instantly share code, notes, and snippets.

@sergiolucero
Created April 6, 2022 21:29
Show Gist options
  • Save sergiolucero/bb8ae7b62f872029a45702571a4531b1 to your computer and use it in GitHub Desktop.
Save sergiolucero/bb8ae7b62f872029a45702571a4531b1 to your computer and use it in GitHub Desktop.
make video from pictures
import cv2, glob
import numpy as np
fourcc = cv2.VideoWriter_fourcc(*'mp4v') # choose codec according to needed format
video = cv2.VideoWriter('video.avi', fourcc, 1, (width, height))
for fn in glob.glob('*.png'):
img = cv2.imread(fn)
video.write(img)
cv2.destroyAllWindows()
video.release()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment