From f959171db5d2be446aa26382c581bc9e1033b30d Mon Sep 17 00:00:00 2001 From: MasterAcnolo <68693319+MasterAcnolo@users.noreply.github.com> Date: Thu, 15 Jan 2026 10:57:37 +0100 Subject: [PATCH] Feat: Add CustomVideo Codec Choice with verification in config.json --- config/config.json | 1 + server/helpers/buildArgs.js | 17 ++++++++++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/config/config.json b/config/config.json index 872dfb0..2fd13e9 100644 --- a/config/config.json +++ b/config/config.json @@ -7,6 +7,7 @@ "addMetadata": true, "verboseLogs": false, "autoDownloadPlaylist": true, + "customCodec": "h264", "logSystem": true, diff --git a/server/helpers/buildArgs.js b/server/helpers/buildArgs.js index 25c8c25..feae9ce 100644 --- a/server/helpers/buildArgs.js +++ b/server/helpers/buildArgs.js @@ -3,7 +3,22 @@ const path = require("path"); const getUserBrowser = require("./getBrowser"); const { ffmpegPath, denoPath} = require("./path"); const { configFeatures } = require("../../config.js"); +const { logger } = require("../logger"); +function validateCodec(codec){ + + const validCodec = [ + "av01","vp9.2", "vp9" , "h265" , "h264" , "vp8" , "h263", "theora" + ] + + if(validCodec.includes(codec)){ + logger.info("Codec Valid:", codec) + return codec + } else{ + logger.error(`Codec not valid: ${codec}. Using default codec`) + return "h264" + } +} function buildYtDlpArgs({ url, audioOnly, quality, outputFolder }) { @@ -21,7 +36,7 @@ function buildYtDlpArgs({ url, audioOnly, quality, outputFolder }) { "--ffmpeg-location", ffmpegPath, "--extractor-args","youtube:player_client=default", "--js-runtimes", `deno:${denoPath}`, - "-S", "vcodec:h264", // Will be replaced with a variables when i will add the settings panel (Next Update ?) + "-S", `vcodec:${validateCodec(configFeatures.customCodec) || "h264"}`, configFeatures.autoDownloadPlaylist ? "--yes-playlist" : "--no-playlist" ];