Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

create thumbnails from big movies with FFmpeg takes too long

Tags:

ffmpeg

I'm using this shell command to make thumbnail from VIDEO_FILE from 123 second and save it to THUMBNAIL_FILE.

ffmpeg -i VIDEO_FILE  -r 1 -ss 123 -f image2 THUMBNAIL_FILE

It works, but it is really slow for big movies. Is there any way to make it a little faster?

like image 319
Kirzilla Avatar asked Feb 05 '10 11:02

Kirzilla


3 Answers

it has happened to me also, changing the argument order fixes this problem. tested on a 1.4GB 90 minute mp4 video - took about 1-2 seconds. before that it took MINUTES...

try this:

ffmpeg -ss 123 -i "VIDEO_FILE" "THUMBNAIL_FILE" -r 1 -vframes 1 -an -vcodec mjpeg
like image 155
Shlomi Cohen Avatar answered Nov 13 '22 07:11

Shlomi Cohen


Ffmpeg is not really good with creating thumbnails as I investigated. People recommend to use mplayer (by ffmpeg creators).

mplayer VIDEO_FILE -ss 00:10:11 -frames 1 -vo jpeg:outdir=THUMBNAILS_DIRECTORY
like image 22
Kirzilla Avatar answered Nov 13 '22 07:11

Kirzilla


A small enhancement to Kirzilla's code: If you want to create PNG files (with compression), you can use the following code:

mplayer VIDEO_FILE -ss 00:10:11 -frames 1 -vo png:z=9:outdir=THUMBNAILS_DIRECTORY

This will probably create better thumbnails but of course with a larger size than JPEG.

like image 31
mreichelt Avatar answered Nov 13 '22 08:11

mreichelt