1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
| import glob import cv2
pngs = glob.glob('temp_png/*.png')
frames = [cv2.imread(png) for png in pngs]
h, w, l = frames[0].shape fourcc = cv2.VideoWriter_fourcc(*'mp4v') video = cv2.VideoWriter(f'{pl}.mp4', fourcc, 15, (w, h)) for f in frames: video.write(f)
cv2.destroyAllWindows() video.release()
|