Created
October 24, 2014 07:03
-
-
Save meoow/456189a45a5daf6de91a to your computer and use it in GitHub Desktop.
Take screenshot (poster) for video at specific seconds
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 python2 | |
import sys | |
import os.path | |
import datetime | |
from subprocess import call | |
width = 1280 | |
sec = str(datetime.timedelta(seconds=int(sys.argv[1]))) | |
for f in sys.argv[2:]: | |
call(['ffmpeg','-hide_banner','-y','-i',f, | |
'-c:v','mjpeg','-q:v','8', '-frames:v','1', | |
'-filter:v','scale=\'min('+str(width)+',iw)/2\':-2', | |
'-an','-sn','-ss',sec,'-f','rawvideo',os.path.splitext(f)[0]+'.jpg']) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment