Spaces:
Paused
Paused
File size: 468 Bytes
b1350bf |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
import imageio.v3 as iio
import os
from sys import argv
video_name = argv[1]
video = video_name
video_id = video.split("/")[-1].replace(".mp4","")
png_base = "png_logs"
try:
os.mkdir(png_base)
except:
pass
video_id = os.path.join(png_base, video_id)
all_frames = list(iio.imiter(video))
ctr = 0
try:
os.makedirs(video_id)
except:
pass
for idx, frame in enumerate(all_frames):
iio.imwrite(f"{video_id}/{ctr:03d}.jpg", frame)
ctr += 1
|