From 5470926d5236ad6deab7cd3690804a7775c2429a Mon Sep 17 00:00:00 2001 From: wukko Date: Thu, 31 Oct 2024 21:31:39 +0600 Subject: [PATCH] api/youtube: adjust matched resolution heights like 714 are now adjusted to 720, so that preferred quality is picked correctly --- api/src/processing/services/youtube.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/api/src/processing/services/youtube.js b/api/src/processing/services/youtube.js index affdf40f..501f2393 100644 --- a/api/src/processing/services/youtube.js +++ b/api/src/processing/services/youtube.js @@ -199,8 +199,10 @@ export default async function(o) { } const quality = o.quality === "max" ? 9000 : Number(o.quality); - const matchQuality = (resolution) => { - return resolution.height > resolution.width ? resolution.width : resolution.height; + + const matchQuality = resolution => { + const quality = resolution.height > resolution.width ? resolution.width : resolution.height; + return Math.ceil(quality / 24) * 24; } let video, audio, dubbedLanguage,