Compare commits
3 Commits
h265
...
e7ff13c14b
Author | SHA1 | Date | |
---|---|---|---|
e7ff13c14b | |||
805d3eb702 | |||
7314c18ca4 |
43
dist/main.js
vendored
43
dist/main.js
vendored
@ -7,7 +7,8 @@ const DEFAULT_HARDWARE_DECODE = false;
|
|||||||
const DEFAULT_VOD_QUALITY = "p7";
|
const DEFAULT_VOD_QUALITY = "p7";
|
||||||
const DEFAULT_HEVC_PROFILE = "main10";
|
const DEFAULT_HEVC_PROFILE = "main10";
|
||||||
const DEFAULT_LIVE_QUALITY = "hq";
|
const DEFAULT_LIVE_QUALITY = "hq";
|
||||||
const DEFAULT_HEVC_ENABLED = false;
|
const DEFAULT_CQ_H264 = 26;
|
||||||
|
const DEFAULT_CQ_HEVC = 28;
|
||||||
const DEFAULT_BITRATES = new Map([
|
const DEFAULT_BITRATES = new Map([
|
||||||
[0, 64 * 1000],
|
[0, 64 * 1000],
|
||||||
[144, 320 * 1000],
|
[144, 320 * 1000],
|
||||||
@ -22,8 +23,9 @@ let pluginSettings = {
|
|||||||
hardwareDecode: DEFAULT_HARDWARE_DECODE,
|
hardwareDecode: DEFAULT_HARDWARE_DECODE,
|
||||||
vodQuality: DEFAULT_VOD_QUALITY,
|
vodQuality: DEFAULT_VOD_QUALITY,
|
||||||
liveQuality: DEFAULT_LIVE_QUALITY,
|
liveQuality: DEFAULT_LIVE_QUALITY,
|
||||||
hevcEnabled: DEFAULT_HEVC_ENABLED,
|
|
||||||
hevcProfile: DEFAULT_HEVC_PROFILE,
|
hevcProfile: DEFAULT_HEVC_PROFILE,
|
||||||
|
cqH264: DEFAULT_CQ_H264,
|
||||||
|
cqHEVC: DEFAULT_CQ_HEVC,
|
||||||
baseBitrate: new Map(DEFAULT_BITRATES)
|
baseBitrate: new Map(DEFAULT_BITRATES)
|
||||||
};
|
};
|
||||||
let latestStreamNum = 9999;
|
let latestStreamNum = 9999;
|
||||||
@ -56,11 +58,19 @@ async function register({ settingsManager, peertubeHelpers, transcodingManager:
|
|||||||
private: false
|
private: false
|
||||||
});
|
});
|
||||||
registerSetting({
|
registerSetting({
|
||||||
name: 'hevc-enabled',
|
name: 'cq-h264',
|
||||||
label: 'Enable H265 NVENC',
|
label: 'CQ Value for H264_nvenc',
|
||||||
type: 'input-checkbox',
|
type: 'input',
|
||||||
descriptionHTML: 'Enables H265 NVENC (experimental)',
|
descriptionHTML: 'Sets the -cq value for h264_nvenc encoder. Valid values are between 0 and 51 (lossess and AIDS, respectively)',
|
||||||
default: DEFAULT_HEVC_ENABLED,
|
default: DEFAULT_CQ_H264,
|
||||||
|
private: false
|
||||||
|
});
|
||||||
|
registerSetting({
|
||||||
|
name: 'cq-hevc',
|
||||||
|
label: 'CQ Value for hevc_nvenc',
|
||||||
|
type: 'input',
|
||||||
|
descriptionHTML: 'Sets the -cq value for hevc_nvenc encoder. Valid values are between 0 and 51 (lossess and AIDS, respectively)',
|
||||||
|
default: DEFAULT_CQ_HEVC,
|
||||||
private: false
|
private: false
|
||||||
});
|
});
|
||||||
registerSetting({
|
registerSetting({
|
||||||
@ -141,7 +151,9 @@ async function loadSettings(settingsManager) {
|
|||||||
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.hevcProfile = parseInt(await settingsManager.getSetting('hevc-profile')) || DEFAULT_HEVC_PROFILE;
|
pluginSettings.hevcProfile = parseInt(await settingsManager.getSetting('hevc-profile')) || DEFAULT_HEVC_PROFILE;
|
||||||
pluginSettings.hevcEnabled = await settingsManager.getSetting('hevc-enabled') || DEFAULT_HEVC_ENABLED;
|
pluginSettings.cqH264 = parseInt(await settingsManager.getSetting('cq-h264')) || DEFAULT_CQ_H264;
|
||||||
|
pluginSettings.cqHEVC = parseInt(await settingsManager.getSetting('cq-hevc')) || DEFAULT_CQ_HEVC;
|
||||||
|
|
||||||
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);
|
||||||
@ -151,7 +163,6 @@ async function loadSettings(settingsManager) {
|
|||||||
logger.info(`Hardware decode: ${pluginSettings.hardwareDecode}`);
|
logger.info(`Hardware decode: ${pluginSettings.hardwareDecode}`);
|
||||||
logger.info(`VOD Quality: ${pluginSettings.vodQuality}`);
|
logger.info(`VOD Quality: ${pluginSettings.vodQuality}`);
|
||||||
logger.info(`Live Quality: ${pluginSettings.liveQuality}`);
|
logger.info(`Live Quality: ${pluginSettings.liveQuality}`);
|
||||||
logger.info(`HEVC enabled: ${pluginSettings.hevcEnabled}`);
|
|
||||||
logger.info(`HEVC profile: ${pluginSettings.hevcProfile}`);
|
logger.info(`HEVC profile: ${pluginSettings.hevcProfile}`);
|
||||||
}
|
}
|
||||||
function printResolution(resolution) {
|
function printResolution(resolution) {
|
||||||
@ -193,7 +204,7 @@ async function vodBuilder(params) {
|
|||||||
if (targetBitrate > inputBitrate) {
|
if (targetBitrate > inputBitrate) {
|
||||||
targetBitrate = inputBitrate;
|
targetBitrate = inputBitrate;
|
||||||
}
|
}
|
||||||
logger.info(`Building encoder options, received ${JSON.stringify(params)}, HEVC: ${pluginSettings.hevcEnabled}`);
|
logger.info(`Building encoder options, received ${JSON.stringify(params)}`);
|
||||||
if (shouldInitVaapi && streamNum != undefined) {
|
if (shouldInitVaapi && streamNum != undefined) {
|
||||||
latestStreamNum = streamNum;
|
latestStreamNum = streamNum;
|
||||||
}
|
}
|
||||||
@ -207,7 +218,7 @@ async function vodBuilder(params) {
|
|||||||
`-b:v${streamSuffix} ${targetBitrate}`,
|
`-b:v${streamSuffix} ${targetBitrate}`,
|
||||||
`-bufsize ${targetBitrate * 2}`,
|
`-bufsize ${targetBitrate * 2}`,
|
||||||
`-profile:v${streamSuffix} high`,
|
`-profile:v${streamSuffix} high`,
|
||||||
`-cq 25`,
|
`-cq ${pluginSettings.cqH264}`,
|
||||||
`-bf 4`
|
`-bf 4`
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
@ -226,7 +237,7 @@ async function hevcVODBuilder(params) {
|
|||||||
if (targetBitrate > inputBitrate) {
|
if (targetBitrate > inputBitrate) {
|
||||||
targetBitrate = inputBitrate;
|
targetBitrate = inputBitrate;
|
||||||
}
|
}
|
||||||
logger.info(`Building encoder options, received ${JSON.stringify(params)}, HEVC: ${pluginSettings.hevcEnabled}`);
|
logger.info(`Building encoder options, received ${JSON.stringify(params)}`);
|
||||||
if (shouldInitVaapi && streamNum != undefined) {
|
if (shouldInitVaapi && streamNum != undefined) {
|
||||||
latestStreamNum = streamNum;
|
latestStreamNum = streamNum;
|
||||||
}
|
}
|
||||||
@ -240,6 +251,7 @@ async function hevcVODBuilder(params) {
|
|||||||
`-b:v${streamSuffix} ${targetBitrate}`,
|
`-b:v${streamSuffix} ${targetBitrate}`,
|
||||||
`-bufsize ${targetBitrate * 2}`,
|
`-bufsize ${targetBitrate * 2}`,
|
||||||
`-profile:v${streamSuffix} ${pluginSettings.hevcProfile}`,
|
`-profile:v${streamSuffix} ${pluginSettings.hevcProfile}`,
|
||||||
|
`-cq ${pluginSettings.cqHEVC}`
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -259,7 +271,7 @@ async function hevcLiveBuilder(params) {
|
|||||||
if (targetBitrate > inputBitrate) {
|
if (targetBitrate > inputBitrate) {
|
||||||
targetBitrate = inputBitrate;
|
targetBitrate = inputBitrate;
|
||||||
}
|
}
|
||||||
logger.info(`Building encoder options, received ${JSON.stringify(params)}, HEVC: ${pluginSettings.hevcEnabled}`);
|
logger.info(`Building encoder options, received ${JSON.stringify(params)}`);
|
||||||
if (shouldInitVaapi && streamNum != undefined) {
|
if (shouldInitVaapi && streamNum != undefined) {
|
||||||
latestStreamNum = streamNum;
|
latestStreamNum = streamNum;
|
||||||
}
|
}
|
||||||
@ -275,6 +287,7 @@ async function hevcLiveBuilder(params) {
|
|||||||
`-profile:v${streamSuffix} ${pluginSettings.hevcProfile}`,
|
`-profile:v${streamSuffix} ${pluginSettings.hevcProfile}`,
|
||||||
`-g:v${streamSuffix} ${fps * 2}`,
|
`-g:v${streamSuffix} ${fps * 2}`,
|
||||||
`-b:v${streamSuffix} ${targetBitrate}`,
|
`-b:v${streamSuffix} ${targetBitrate}`,
|
||||||
|
`-cq ${pluginSettings.cqHEVC}`,
|
||||||
`-bufsize ${targetBitrate * 2}`
|
`-bufsize ${targetBitrate * 2}`
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
@ -294,7 +307,7 @@ async function liveBuilder(params) {
|
|||||||
if (targetBitrate > inputBitrate) {
|
if (targetBitrate > inputBitrate) {
|
||||||
targetBitrate = inputBitrate;
|
targetBitrate = inputBitrate;
|
||||||
}
|
}
|
||||||
logger.info(`Building encoder options, received ${JSON.stringify(params)}, HEVC: ${pluginSettings.hevcEnabled}`);
|
logger.info(`Building encoder options, received ${JSON.stringify(params)}`);
|
||||||
if (shouldInitVaapi && streamNum != undefined) {
|
if (shouldInitVaapi && streamNum != undefined) {
|
||||||
latestStreamNum = streamNum;
|
latestStreamNum = streamNum;
|
||||||
}
|
}
|
||||||
@ -308,7 +321,7 @@ async function liveBuilder(params) {
|
|||||||
`-tune ${pluginSettings.liveQuality}`,
|
`-tune ${pluginSettings.liveQuality}`,
|
||||||
`-r:v${streamSuffix} ${fps}`,
|
`-r:v${streamSuffix} ${fps}`,
|
||||||
`-profile:v${streamSuffix} high`,
|
`-profile:v${streamSuffix} high`,
|
||||||
`-cq 25`,
|
`-cq ${pluginSettings.cqH264}`,
|
||||||
`-g:v${streamSuffix} ${fps * 2}`,
|
`-g:v${streamSuffix} ${fps * 2}`,
|
||||||
`-b:v${streamSuffix} ${targetBitrate}`,
|
`-b:v${streamSuffix} ${targetBitrate}`,
|
||||||
`-bufsize ${targetBitrate * 2}`,
|
`-bufsize ${targetBitrate * 2}`,
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "peertube-plugin-nctv-nvenc-transcode",
|
"name": "peertube-plugin-nctv-nvenc-transcode",
|
||||||
"version": "1.1.1",
|
"version": "1.2.0",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"description": "Plugin that adds transcode profiles which use NVIDIA NVENC for hardware acceleration",
|
"description": "Plugin that adds transcode profiles which use NVIDIA NVENC for hardware acceleration",
|
||||||
"engine": {
|
"engine": {
|
||||||
|
Reference in New Issue
Block a user