From 602c8583791ca3b9c929dbb26f84f860ce57c26b Mon Sep 17 00:00:00 2001 From: tobi <31960611+tsmethurst@users.noreply.github.com> Date: Fri, 18 Oct 2024 15:44:08 +0200 Subject: [chore] Thumbnail only first frame of animated media (#3448) --- internal/media/ffmpeg.go | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) (limited to 'internal/media/ffmpeg.go') diff --git a/internal/media/ffmpeg.go b/internal/media/ffmpeg.go index f1c277934..ba251bd26 100644 --- a/internal/media/ffmpeg.go +++ b/internal/media/ffmpeg.go @@ -78,23 +78,17 @@ func ffmpegGenerateWebpThumb(ctx context.Context, inpath, outpath string, width, // (NOT as libwebp_anim). "-codec:v", "libwebp", - // Select thumb from first 7 frames. - // (in particular <= 7 reduced memory usage, marginally) - // (thumb filter: https://ffmpeg.org/ffmpeg-filters.html#thumbnail) - "-filter:v", "thumbnail=n=7,"+ + // Only one frame + "-frames:v", "1", - // Scale to dimensions - // (scale filter: https://ffmpeg.org/ffmpeg-filters.html#scale) - "scale="+strconv.Itoa(width)+ - ":"+strconv.Itoa(height)+","+ + // Scale to dimensions + // (scale filter: https://ffmpeg.org/ffmpeg-filters.html#scale) + "-filter:v", "scale="+strconv.Itoa(width)+":"+strconv.Itoa(height)+","+ // Attempt to use original pixel format // (format filter: https://ffmpeg.org/ffmpeg-filters.html#format) "format=pix_fmts="+pixfmt, - // Only one frame - "-frames:v", "1", - // Quality not specified, // i.e. use default which // should be 75% webp quality. -- cgit v1.2.3