Spaces:
Sleeping
Sleeping
from moviepy.editor import VideoFileClip | |
from os import listdir | |
from os.path import isfile, join, isdir | |
mypath = './' | |
onlyfolders = [f for f in listdir(mypath) if isdir(join(mypath, f))] | |
for folder in onlyfolders: | |
print(folder) | |
fs = [join(mypath, folder, f) for f in listdir(join(mypath, folder)) if isfile(join(mypath, folder, f))] | |
print(fs) | |
for f in fs: | |
if f.endswith(".mp4"): | |
clip = VideoFileClip(f) | |
clip = clip.resize(height=512) | |
clip = clip.set_fps(10) | |
clip.write_gif(f.replace('.mp4', '.gif'), program='ffmpeg') | |