At current state, thumbnail generator uses the formula
(video_duration / no_of_thumbnails) * X - 1
(where X iterates from 1 to no_of_thumbnails) to calculate thumbnail seek time.
If our video is 28 seconds long and we want 4 thumbnails, that would require 1 thumbnail per 7 seconds. The above formula makes a thumbnail at this point of that 7-second segment:
-----|-
So the whole video with thumbnails looks like this:
-----|------|------|------|-
This still poses a risk of last-second thumbnail generation attempts, which ffmpeg has problems with. Changing the formula to
(video_duration / no_of_thumbnails) * (X - 0.5)
makes the seek time (for each thumbnail per video segment) look like this:
---|---
so the whole video with its thumbnails looks like this:
---|------|------|------|---
The code is on the line 127 of transcoders/TranscoderAbstractionFactoryFfmpeg.inc
Comments
Comment #1
Jorrit commentedI have fixed this problem in 7.x-2.x with a slightly different formula as part of #1345324: PHPVideoToolkit Error: Execute error.Please check server write permissions and/or available codecs compiled with FFmpeg. You can, but your explanation of the problem was definitely correct.