Skip to content

Instantly share code, notes, and snippets.

@IanSmith123
Created July 12, 2018 09:35
Show Gist options
  • Save IanSmith123/f951eb382d6d27f648273658cb5bc177 to your computer and use it in GitHub Desktop.
Save IanSmith123/f951eb382d6d27f648273658cb5bc177 to your computer and use it in GitHub Desktop.
from png/jpg to mp4 use ffmpeg,
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
@IanSmith123
Copy link
Author

遍历所有文件夹内的图片,生成动图

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment