feat: implement 4k upscaling

This commit is contained in:
Trevor Mears
2026-01-19 01:45:44 -08:00
parent 237d11cf00
commit 059cfecdcc
+11 -4
View File
@@ -360,18 +360,25 @@ class TranscodeSession extends EventEmitter {
/** /**
* Get target height based on maxResolution or upscaleTarget setting * Get target height based on maxResolution or upscaleTarget setting
* @param {boolean} forUpscale - If true, returns upscale target instead of max resolution * When upscaling is enabled, uses the upscaleTarget resolution.
* Otherwise, uses maxResolution to cap the output.
*/ */
getTargetHeight(forUpscale = false) { getTargetHeight() {
const resolutionMap = { const resolutionMap = {
'4k': 2160, '4k': 2160,
'1080p': 1080, '1080p': 1080,
'720p': 720, '720p': 720,
'480p': 480 '480p': 480
}; };
if (forUpscale && this.options.upscaleEnabled) {
return resolutionMap[this.options.upscaleTarget] || 1080; // When upscaling is enabled, use the upscale target resolution
if (this.options.upscaleEnabled) {
const target = resolutionMap[this.options.upscaleTarget] || 1080;
console.log(`[TranscodeSession ${this.id}] Upscale target height: ${target}p`);
return target;
} }
// Otherwise, use max resolution as the cap
return resolutionMap[this.options.maxResolution] || 1080; return resolutionMap[this.options.maxResolution] || 1080;
} }