
an disables audio and -y overwrites the output file without asking. movflags +faststart moves all metadata to the beginning of the file. This is relatively low, resulting in a tiny file of 51.1 KB. vcodec libx264 -preset medium -crf 31 tells FFmpeg to use the x264 encoder with medium encoding speed and a constant quality of 31. sws_flags gauss sets the scaling algorithm to Gaussian. Setpts=PTS-STARTPTS changes the presentation timestamp of all frames, so that the trimmed video starts at 00:04:31 of the original. Scale=320:-1 scales the video proportionally to a width of 320 pixels. The colon has to be escaped because colons separate parameters in the filtergraph syntax. vf sets the filtergraph, which in this case consists of three operations, separated by commas. The one-liner is split into multiple lines to make explaining the different parts easy. It enables you to show your most appealing scene on hover, as soon as the video enters the viewport or in an endless loop. If you want to trim your source file to a video snippet of a few seconds you have to modify the following FFmpeg command.



The video being used is the open-source Big Buck Bunny by the Blender Foundation. You can install the command-line tool either via or your package manager, for example brew install ffmpeg on macOS.

The examples both use the FFmpeg library. This article highlights two approaches to grab your viewers’ attention. Though you don’t have to stop there and can boost your video previews and click-through rate by showing more than a single still image of each video. If you are building a video portal, an artist’s portfolio or any other showcase of films, from smartphone footage to news coverage to sports clips, you typically look for engaging thumbnails.
