From e86fd707ea6963e03f59da686558c22d986a8321 Mon Sep 17 00:00:00 2001 From: DrSmoothl <1787882683@qq.com> Date: Mon, 6 Jul 2026 01:44:10 +0800 Subject: [PATCH] fix(video): declare the cover's own dimensions on the thumbnail sub-file --- packages/protocol/src/highway/video-upload.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/packages/protocol/src/highway/video-upload.ts b/packages/protocol/src/highway/video-upload.ts index 8da66306..c7bff801 100644 --- a/packages/protocol/src/highway/video-upload.ts +++ b/packages/protocol/src/highway/video-upload.ts @@ -224,6 +224,14 @@ async function loadThumb(element: MessageElement, videoPath: string): Promise<{ height = height || fmt.height || 1; duration = duration || 1; + // The cover sub-file must declare its OWN pixel size, which can be smaller + // than the video: the ffmpeg addon downscales large frames (4K/8K → ≤1080p) + // so the JPEG cover stays under QQ's 1 MiB cover limit. Fall back to the video + // dims when the format can't be read. For 1080p and custom-thumb sends the + // cover already equals the video size, so this is a no-op there. + const thumbWidth = fmt.width || width; + const thumbHeight = fmt.height || height; + const hashes = computeHashes(thumbBytes); return { width, @@ -235,8 +243,8 @@ async function loadThumb(element: MessageElement, videoPath: string): Promise<{ sha1: hashes.sha1, md5Hex: hashes.md5Hex, sha1Hex: hashes.sha1Hex, - width, - height, + width: thumbWidth, + height: thumbHeight, }, }; }