Last active
April 17, 2022 17:10
-
-
Save arifsuhan/022cd9de00e413c03150f2cb4b5eeac9 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
import cv2 | |
import numpy as np | |
from tqdm import tqdm | |
def gen(filename, length): | |
width = 720 | |
height = 360 | |
fps = 30 | |
frame_n = length * fps | |
writer = cv2.VideoWriter(filename+".avi", cv2.VideoWriter_fourcc(*"MJPG"), fps,(width,height)) | |
for frame in tqdm(range(frame_n)): | |
writer.write(np.random.randint(0, 255, (height,width,3)).astype('uint8')) | |
writer.release() | |
# gen(filename, video_in_seconds) | |
# gen("output", 30) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment