mirror of https://github.com/stashapp/stash.git
Fix incorrect sprites
The step size was being cast to an int which made the time lose precision and would offset sprite images incorrectly
This commit is contained in:
parent
b31af52d41
commit
9a51c586db
|
@ -66,15 +66,15 @@ func (g *SpriteGenerator) generateSpriteImage(encoder *ffmpeg.Encoder) error {
|
|||
logger.Infof("[generator] generating sprite image for %s", g.Info.VideoFile.Path)
|
||||
|
||||
// Create `this.chunkCount` thumbnails in the tmp directory
|
||||
stepSize := int(g.Info.VideoFile.Duration / float64(g.Info.ChunkCount))
|
||||
stepSize := g.Info.VideoFile.Duration / float64(g.Info.ChunkCount)
|
||||
for i := 0; i < g.Info.ChunkCount; i++ {
|
||||
time := i * stepSize
|
||||
time := float64(i) * stepSize
|
||||
num := fmt.Sprintf("%.3d", i)
|
||||
filename := "thumbnail" + num + ".jpg"
|
||||
|
||||
options := ffmpeg.ScreenshotOptions{
|
||||
OutputPath: instance.Paths.Generated.GetTmpPath(filename),
|
||||
Time: float64(time),
|
||||
Time: time,
|
||||
Width: 160,
|
||||
}
|
||||
encoder.Screenshot(g.Info.VideoFile, options)
|
||||
|
|
Loading…
Reference in New Issue