Creating a Video Thumbnail
You might want to create a thumbnail for a video that you downloaded from a website. These could be used on a page that shows a number of video thumbnails and lets you click on them to watch the specific video.
Getting ready
This sample will use a tool known as ffmpeg. ffmpeg is available at www.ffmpeg.org. Download and install as per the instructions for your operating system.
How to do it
The example script is in 04/11_create_video_thumbnail.py
. It consists of the following code:
import subprocess video_file = 'BigBuckBunny.mp4' thumbnail_file = 'thumbnail.jpg' subprocess.call(['ffmpeg', '-i', video_file, '-ss', '00:01:03.000', '-vframes', '1', thumbnail_file, "-y"])
When run you will see output from ffmpeg:
built with Apple LLVM version 8.1.0 (clang-802.0.42) configuration: --prefix=/usr/local/Cellar/ffmpeg/3.3.4 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags...