Is there a way to grab a video thumbnail in FFmpeg?
I'd like to grab the middle-most frame as the video and use that as the thumbnail. Video duration is unknown.
The ability to specify the dimensions of the thumbnail would also be helpful.
First of all, always use the latest version of FFmpeg.
If you have access to PHP, your question is perfectly answered on Stack Overflow: Use FFMpeg to get middle frame of a video?
What it'll do is just extract the duration from FFmpeg's output and use that to determine the timecode of the middle frame.
You can easily adapt that to other shells, and simply insert into the following command, where the middle frame is roughly at
You can always change the size with
The above solution is a little inaccurate. It'll immediately give you a result but you can't specify which frame you want. If you already know the exact frame you want to extract, use the
Note that this command can take a while since it needs to skip to the specified frame before it can extract it.
In on line :
In the subcommand we get the total duration of the input video
And we pipe it to awk to compute duration/2 like this
So we give this among of seconds to -ss option and it's done.
If you would like to specify the size, add -s option like that WxH whet W and H are integer values (ex: -s 800x600 or -s svga) or read the ffmpeg man page to see other available options or format.
This bash command works like a charm:
Here's a method using: