Created
March 30, 2020 14:06
-
-
Save aravindpai/41101e77ef307d057da4462f38be4860 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
frames = os.listdir('frames/') | |
frames.sort(key=lambda f: int(re.sub('\D', '', f))) | |
frame_array=[] | |
for i in range(len(frames)): | |
#reading each files | |
img = cv2.imread('frames/'+frames[i]) | |
height, width, layers = img.shape | |
size = (width,height) | |
#inserting the frames into an image array | |
frame_array.append(img) | |
out = cv2.VideoWriter('28.mp4',cv2.VideoWriter_fourcc(*'DIVX'), 25, size) | |
for i in range(len(frame_array)): | |
# writing to a image array | |
out.write(frame_array[i]) | |
out.release() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment