feat(transcode): add multi-resolution strategy with configurable ladders and fallback (#438)

* feat(transcode): add multi-resolution strategy with configurable ladders and fallback

* feat(settings): show toast on settings update and add manual verification plan to PR template

* fix(webui): preserve video resolution and fix 480p label in download dropdowns

* fix(webui): display standard short-side resolution for vertical videos in seekbar

* fix(webui): fix portrait transcode resolution labeling and serialize settings toggles
This commit is contained in:
Yiling-J
2026-10-01 13:27:50 +08:00
committed by GitHub
parent a84da8678e
commit e007054f47
35 changed files with 1260 additions and 123 deletions
@@ -145,6 +145,7 @@ export function MobileFileDetail({
key: t.key,
width: t.width,
height: t.height,
resolution: t.resolution,
hdr: t.hdr,
})),
}
@@ -119,4 +119,69 @@ describe('MobileFileHeader', () => {
expect(menuBtn).toBeDefined()
fireEvent.click(menuBtn)
})
it('displays 480p instead of 360p for 480p video transcode in download menu', () => {
render(
<MobileFileHeader
fileName="scene1.mp4"
activeFileId="file-1"
allowDownload={true}
onBack={vi.fn()}
downloadInfo={{
originalKey: 'raw.mov',
videoTranscodes: [
{
key: 'scene1-480p.mp4',
width: 854,
height: 480,
resolution: '480p',
hdr: false,
},
],
}}
/>,
)
const menuBtn = screen.getByLabelText(/More options/i)
fireEvent.pointerDown(menuBtn, { button: 0, ctrlKey: false })
const downloadSubTrigger = screen.getByText('Download')
fireEvent.click(downloadSubTrigger)
const items = screen.getAllByRole('menuitem')
expect(items.some((i) => i.textContent?.includes('480p'))).toBe(true)
expect(items.some((i) => i.textContent?.includes('360p'))).toBe(false)
})
it('correctly labels legacy portrait video transcode in download menu using long side fallback', () => {
render(
<MobileFileHeader
fileName="portrait.mp4"
activeFileId="file-portrait"
allowDownload={true}
onBack={vi.fn()}
downloadInfo={{
originalKey: 'raw.mp4',
videoTranscodes: [
{
key: 'portrait-legacy.mp4',
width: 1080,
height: 1920,
hdr: false,
},
],
}}
/>,
)
const menuBtn = screen.getByLabelText(/More options/i)
fireEvent.pointerDown(menuBtn, { button: 0, ctrlKey: false })
const downloadSubTrigger = screen.getByText('Download')
fireEvent.click(downloadSubTrigger)
const items = screen.getAllByRole('menuitem')
expect(items.some((i) => i.textContent?.includes('1080p'))).toBe(true)
expect(items.some((i) => i.textContent?.includes('1920p'))).toBe(false)
})
})
@@ -26,6 +26,7 @@ import {
Trash2,
} from 'lucide-react'
import React from 'react'
import { getVideoResolutionLabel } from '@/ui/lib/media'
export interface MobileFileHeaderProps {
fileName: string
@@ -46,6 +47,7 @@ export interface MobileFileHeaderProps {
key: string
width: number
height: number
resolution?: string
hdr?: boolean
}>
}
@@ -238,14 +240,7 @@ export function MobileFileHeader({
<DropdownMenuSubContent className="w-48 z-50">
<DropdownMenuLabel className="text-xs">{m.download()}</DropdownMenuLabel>
{downloadInfo?.videoTranscodes?.map((t) => {
const longSide = Math.max(t.width, t.height)
let resolution = `${t.height}p`
if (longSide >= 3840) resolution = '2160p'
else if (longSide >= 1920) resolution = '1080p'
else if (longSide >= 1280) resolution = '720p'
else if (longSide >= 960) resolution = '540p'
else if (longSide >= 640) resolution = '360p'
else if (longSide >= 320) resolution = '180p'
const resolution = getVideoResolutionLabel(t)
const label = t.hdr ? `${resolution} (HDR)` : resolution
return (
<DropdownMenuItem