mass-video-transcode/convert.py
2020-05-08 15:32:23 +02:00

25 lines
797 B
Python

#!/usr/bin/python3
from os import listdir, system
from os.path import isfile, join
mypath="ImagesIn"
onlyfiles = [f for f in listdir(mypath) if isfile(join(mypath, f))]
#print("Here are the files in the Images folder")
for f in onlyfiles:
# print(f)
# print("Converting " + f + " from WebM to GIF.")
# system("ffmpeg.exe -i \"ImagesIn\\" + f + "\" \"ImagesOut\\" + f + ".gif\"")
print(f[-4:])
if f[-4:] == ".mp4":
print(f + " is an mp4 file, converting to GIF.")
system("ffmpeg.exe -i \"ImagesIn\\" + f + "\" \"ImagesOut\\" + f[:-4] + ".gif\"")
elif f[-5:] == ".webm":
print(f + " is a WebM file, converting to GIF.")
system("ffmpeg.exe -i \"ImagesIn\\" + f + "\" \"ImagesOut\\" + f[:-5] + ".gif\"")
#print("And that was all the files.")