I've been annoyed with the performance of generating thumbnails for some time and did some research. It turns out that having -ss follow -i causes ffmpeg to decode the video. So that explains why it takes so much CPU and time to generate thumbnails. This is easily fixed by moving -ss before -i
-ss !seek -i !videofile -an -y -f mjpeg -vframes 1 !thumbfile

This has changed the time generate thumbnails to a reasonable amount whereas the old code was taking over 30 minutes on some really big video files.

http://planetcakephp.org/aggregator/items/3401-ffmpeg-multiple-thumbnails is what guided me in this way. I was originally trying to see if we could generate all the thumbnails in a single ffmpeg but this simple change has made that moot.

CommentFileSizeAuthor
#3 1114102-thumbnail_performance.patch637 bytesamateescu

Comments

lismail’s picture

It's very simple yet straight to the issue. Thank you and +1 for sharing this.

trent--’s picture

Version: 6.x-4.2-beta2 » master

I can confirm that this speeds up thumbnail generation, moving to master because it's the same in v7

amateescu’s picture

Version: master » 7.x-1.x-dev
Status: Active » Needs review
StatusFileSize
new637 bytes

And here's a patch for 7.x-1.x-dev.

hypertext200’s picture

Version: 7.x-1.x-dev » 7.x-2.x-dev
Status: Needs review » Closed (fixed)