Spaces:
Sleeping
Sleeping
File size: 592 Bytes
afb5083 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
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')
|