From b1efd289d3f04bd01b8aa503aba2055648add04d Mon Sep 17 00:00:00 2001 From: Manav Rathi Date: Tue, 29 Apr 2025 13:04:15 +0530 Subject: [PATCH] tm thumb --- web/packages/gallery/services/ffmpeg/index.ts | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/web/packages/gallery/services/ffmpeg/index.ts b/web/packages/gallery/services/ffmpeg/index.ts index 2c408c3c66..d0309b22a6 100644 --- a/web/packages/gallery/services/ffmpeg/index.ts +++ b/web/packages/gallery/services/ffmpeg/index.ts @@ -83,12 +83,23 @@ const makeGenThumbnailCommand = (seekTime: number) => [ ffmpegPathPlaceholder, "-i", inputPathPlaceholder, + // Seek to seekTime in the video. "-ss", `00:00:0${seekTime}`, + // Take the first frame "-vframes", "1", + // Apply a filter to this frame "-vf", - "scale=-1:720", + [ + // - Scale it to a maximum height of 720 keeping aspect ratio + "scale=-1:720", + // - Apply a tonemap to ensure that thumbnails of HDR videos do not look + // washed out. See: [Note: Tonemapping HDR to HD]. + "zscale=transfer=linear", + "tonemap=tonemap=hable:desat=0", + "zscale=primaries=709:transfer=709:matrix=709", + ].join(","), outputPathPlaceholder, ];