From ab4f56213ff9ddb29461821f16511c945ab0f090 Mon Sep 17 00:00:00 2001 From: therandomguy42 <62359200+therandomguy42@users.noreply.github.com> Date: Tue, 1 Aug 2023 06:17:34 +0200 Subject: [PATCH] Fix non-animated avif files getting classified as video files (#3913) --- pkg/file/image/scan.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/pkg/file/image/scan.go b/pkg/file/image/scan.go index dbf272b19..5203adba9 100644 --- a/pkg/file/image/scan.go +++ b/pkg/file/image/scan.go @@ -56,6 +56,16 @@ func (d *Decorator) Decorate(ctx context.Context, fs file.FS, f file.File) (file return decorateFallback() } + // Fallback to catch non-animated avif images that FFProbe detects as video files + if probe.Bitrate == 0 && probe.VideoCodec == "av1" { + return &file.ImageFile{ + BaseFile: base, + Format: "avif", + Width: probe.Width, + Height: probe.Height, + }, nil + } + isClip := true // This list is derived from ffmpegImageThumbnail in pkg/image/thumbnail. If one gets updated, the other should be as well for _, item := range []string{"png", "mjpeg", "webp"} {