Created
January 19, 2018 12:26
-
-
Save sweisgerber-dev/179477552c2f485ca66267b2b4798c0a to your computer and use it in GitHub Desktop.
Python 3 Image Thumbnailer
This file contains 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
#!/usr/bin/env python3 | |
import argparse | |
import glob, os | |
from subprocess import call | |
def main(args): | |
os.chdir(".") | |
for file in glob.glob("*.mp4"): | |
foldername = str(file).replace('.mp4', '') | |
if not os.path.exists(foldername): | |
os.makedirs(foldername) | |
# full_filename = os.path.join(foldername) | |
command = ["ffmpeg", "-i", "{}".format(file), "-vf", "fps=1", "{}/{}-%03d.jpg".format(foldername, foldername)] | |
call(command) | |
if __name__ == "__main__": | |
print('.: Video Thumbnailer :.') | |
parser = argparse.ArgumentParser() | |
args = parser.parse_args() | |
main(args) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment