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.
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | 1114102-thumbnail_performance.patch | 637 bytes | amateescu |
Comments
Comment #1
lismail commentedIt's very simple yet straight to the issue. Thank you and +1 for sharing this.
Comment #2
trent-- commentedI can confirm that this speeds up thumbnail generation, moving to master because it's the same in v7
Comment #3
amateescu commentedAnd here's a patch for 7.x-1.x-dev.
Comment #4
hypertext200