more settings

This commit is contained in:
matty 2024-04-13 18:01:06 -04:00
parent 98acf0be91
commit 901d20e265

8
dist/main.js vendored
View File

@ -6,7 +6,7 @@ let transcodingManager;
const DEFAULT_HARDWARE_DECODE = false; const DEFAULT_HARDWARE_DECODE = false;
const DEFAULT_VOD_QUALITY = "p7"; const DEFAULT_VOD_QUALITY = "p7";
const DEFAULT_LIVE_QUALITY = "hq"; const DEFAULT_LIVE_QUALITY = "hq";
const DEFAULT_CQ = 21; const DEFAULT_CQ = 23;
const DEFAULT_BITRATES = new Map([ const DEFAULT_BITRATES = new Map([
[0, 64 * 1000], [0, 64 * 1000],
[144, 320 * 1000], [144, 320 * 1000],
@ -77,6 +77,7 @@ async function register({ settingsManager, peertubeHelpers, transcodingManager:
registerSetting({ registerSetting({
name: 'constant-quality', name: 'constant-quality',
label: 'Constant Quality (-cq)', label: 'Constant Quality (-cq)',
descriptionHTML: 'Edit the constant quality (-cq) for videos. The lower the number, the higher the perceived visual fidelity and file size.',
type: 'input', type: 'input',
default: DEFAULT_CQ.toString(), default: DEFAULT_CQ.toString(),
private: false, private: false,
@ -115,6 +116,7 @@ async function loadSettings(settingsManager) {
pluginSettings.hardwareDecode = await settingsManager.getSetting('hardware-decode') == "true"; pluginSettings.hardwareDecode = await settingsManager.getSetting('hardware-decode') == "true";
pluginSettings.vodQuality = parseInt(await settingsManager.getSetting('vod-quality')) || DEFAULT_VOD_QUALITY; pluginSettings.vodQuality = parseInt(await settingsManager.getSetting('vod-quality')) || DEFAULT_VOD_QUALITY;
pluginSettings.liveQuality = parseInt(await settingsManager.getSetting('live-quality')) || DEFAULT_LIVE_QUALITY; pluginSettings.liveQuality = parseInt(await settingsManager.getSetting('live-quality')) || DEFAULT_LIVE_QUALITY;
pluginSettings.cqQuality = parseInt(await settingsManager.getSetting('constant-quality')) || DEFAULT_CQ;
for (const [resolution, bitrate] of DEFAULT_BITRATES) { for (const [resolution, bitrate] of DEFAULT_BITRATES) {
const key = `base-bitrate-${resolution}`; const key = `base-bitrate-${resolution}`;
const storedValue = await settingsManager.getSetting(key); const storedValue = await settingsManager.getSetting(key);
@ -176,7 +178,7 @@ async function vodBuilder(params) {
// `-bufsize ${targetBitrate * 2}`, // `-bufsize ${targetBitrate * 2}`,
//`-crf 21`, // increased 19 to 21, file size massive //`-crf 21`, // increased 19 to 21, file size massive
`-profile:v${streamSuffix} high`, `-profile:v${streamSuffix} high`,
`-cq 21`, `-cq 22`,
`-c:v${streamSuffix} h264_nvenc` `-c:v${streamSuffix} h264_nvenc`
] ]
}; };
@ -206,7 +208,7 @@ async function liveBuilder(params) {
// `-r:v${streamSuffix} ${fps}`, // `-r:v${streamSuffix} ${fps}`,
`-profile:v${streamSuffix} high`, `-profile:v${streamSuffix} high`,
`-c:v${streamSuffix} h264_nvenc`, `-c:v${streamSuffix} h264_nvenc`,
`-cq 21` `-cq 22`
// `-g:v${streamSuffix} ${fps * 2}`, // `-g:v${streamSuffix} ${fps * 2}`,
// `-b:v${streamSuffix} ${targetBitrate}`, // `-b:v${streamSuffix} ${targetBitrate}`,
// `-bufsize ${targetBitrate * 2}`, // `-bufsize ${targetBitrate * 2}`,