Creating thumbnails from video files with Python
I could not install ffvideo on OSX Sierra so i decided to work with ffmpeg.
OSX:
brew install ffmpeg
Linux:
apt-get install ffmpeg
Python 3 Code:
import subprocess
video_input_path = '/your/video.mp4'
img_output_path = '/your/image.jpg'
subprocess.call(['ffmpeg', '-i', video_input_path, '-ss', '00:00:00.000', '-vframes', '1', img_output_path])
You can use ffvideo
from ffvideo import VideoStream
pil_image = VideoStream('0.flv').get_frame_at_sec(5).image()
pil_image.save('frame5sec.jpeg')
A simple combination of PyMedia and PIL would do the trick for AVI, ASF, or MPEG files. PyMedia lets you extract the frames (using the decoder() routine), while PIL has a simple thumbnail() routine.