Skip to content

Instantly share code, notes, and snippets.

@meoow
Created October 24, 2014 07:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save meoow/456189a45a5daf6de91a to your computer and use it in GitHub Desktop.
Save meoow/456189a45a5daf6de91a to your computer and use it in GitHub Desktop.
Take screenshot (poster) for video at specific seconds
#!/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