Created
July 12, 2018 09:35
-
-
Save IanSmith123/f951eb382d6d27f648273658cb5bc177 to your computer and use it in GitHub Desktop.
from png/jpg to mp4 use ffmpeg,
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 os | |
folders = os.listdir() | |
# folders = [f for f in listdir(mypath) if not isfile(join(mypath, f))] | |
for folder in folders: | |
if "store" in folder.lower(): | |
print("skip ", folder) | |
continue | |
try: | |
os.system( | |
f"ffmpeg -framerate 2 -i {folder}/{folder}_%d.png -c:v libx264 -r 30 -pix_fmt yuv420p after_{folder}.mp4" | |
) | |
except KeyboardInterrupt: | |
exit(1) | |
except: | |
print("error", folder) | |
continue |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
遍历所有文件夹内的图片,生成动图