FFmpeg: Seek input not output video (#3893)
This improves performance when converting video to images as we no longer have to decode and then discard the first x seconds of video.
This commit is contained in:
parent
052fe82126
commit
d32bc4cc6c
2 changed files with 2 additions and 2 deletions
|
@ -29,7 +29,7 @@ func (c *Convert) JpegConvertCommands(f *MediaFile, jpegName string, xmpName str
|
|||
// Extract a still image to be used as preview.
|
||||
if f.IsAnimated() && !f.IsWebP() && c.conf.FFmpegEnabled() {
|
||||
// Use "ffmpeg" to extract a JPEG still image from the video.
|
||||
result = append(result, exec.Command(c.conf.FFmpegBin(), "-y", "-i", f.FileName(), "-ss", ffmpeg.PreviewTimeOffset(f.Duration()), "-vframes", "1", jpegName))
|
||||
result = append(result, exec.Command(c.conf.FFmpegBin(), "-y", "-ss", ffmpeg.PreviewTimeOffset(f.Duration()), "-i", f.FileName(), "-vframes", "1", jpegName))
|
||||
}
|
||||
|
||||
// Use heif-convert for HEIC/HEIF and AVIF image files.
|
||||
|
|
|
@ -28,7 +28,7 @@ func (c *Convert) PngConvertCommands(f *MediaFile, pngName string) (result []*ex
|
|||
// Extract a video still image that can be used as preview.
|
||||
if f.IsAnimated() && !f.IsWebP() && c.conf.FFmpegEnabled() {
|
||||
// Use "ffmpeg" to extract a PNG still image from the video.
|
||||
result = append(result, exec.Command(c.conf.FFmpegBin(), "-y", "-i", f.FileName(), "-ss", ffmpeg.PreviewTimeOffset(f.Duration()), "-vframes", "1", pngName))
|
||||
result = append(result, exec.Command(c.conf.FFmpegBin(), "-y", "-ss", ffmpeg.PreviewTimeOffset(f.Duration()), "-i", f.FileName(), "-vframes", "1", pngName))
|
||||
}
|
||||
|
||||
// Use heif-convert for HEIC/HEIF and AVIF image files.
|
||||
|
|
Loading…
Reference in a new issue