fuck it, just go with input bitrate

This commit is contained in:
matty 2024-04-13 19:04:47 -04:00
parent b24c0e4ef7
commit 4b8b0e4888

24
dist/main.js vendored
View File

@ -146,12 +146,12 @@ function buildInitOptions() {
async function vodBuilder(params) {
const { resolution, fps, streamNum, inputBitrate } = params;
const streamSuffix = streamNum == undefined ? '' : `:${streamNum}`;
let targetBitrate = getTargetBitrate(resolution, fps);
// let targetBitrate = inputBitrate;
//let targetBitrate = getTargetBitrate(resolution, fps);
let targetBitrate = inputBitrate;
let shouldInitVaapi = (streamNum == undefined || streamNum <= latestStreamNum);
if (targetBitrate > inputBitrate) {
targetBitrate = inputBitrate;
}
//if (targetBitrate > inputBitrate) {
// targetBitrate = inputBitrate;
//}
logger.info(`Building encoder options, received ${JSON.stringify(params)}`);
if (shouldInitVaapi && streamNum != undefined) {
latestStreamNum = streamNum;
@ -166,7 +166,7 @@ async function vodBuilder(params) {
`-b:v${streamSuffix} ${targetBitrate}`,
`-bufsize ${targetBitrate * 2}`,
`-profile:v${streamSuffix} high`,
`-cq 22`,
`-cq 24`,
`-c:v${streamSuffix} h264_nvenc`
]
};
@ -176,12 +176,12 @@ async function vodBuilder(params) {
async function liveBuilder(params) {
const { resolution, fps, streamNum, inputBitrate } = params;
const streamSuffix = streamNum == undefined ? '' : `:${streamNum}`;
let targetBitrate = getTargetBitrate(resolution, fps);
// let targetBitrate = inputBitrate;
// let targetBitrate = getTargetBitrate(resolution, fps);
let targetBitrate = inputBitrate;
let shouldInitVaapi = (streamNum == undefined || streamNum <= latestStreamNum);
if (targetBitrate > inputBitrate) {
targetBitrate = inputBitrate;
}
//if (targetBitrate > inputBitrate) {
// targetBitrate = inputBitrate;
//}
logger.info(`Building encoder options, received ${JSON.stringify(params)}`);
if (shouldInitVaapi && streamNum != undefined) {
latestStreamNum = streamNum;
@ -196,7 +196,7 @@ async function liveBuilder(params) {
`-r:v${streamSuffix} ${fps}`,
`-profile:v${streamSuffix} high`,
`-c:v${streamSuffix} h264_nvenc`,
`-cq 22`,
`-cq 24`,
`-g:v${streamSuffix} ${fps * 2}`,
`-b:v${streamSuffix} ${targetBitrate}`,
`-bufsize ${targetBitrate * 2}`