set bitrate to input if lower than target bitrate
This commit is contained in:
parent
b254ee282d
commit
044975b376
16
src/main.ts
16
src/main.ts
@ -165,11 +165,15 @@ function buildInitOptions() {
|
||||
}
|
||||
|
||||
async function vodBuilder(params: EncoderOptionsBuilderParams) : Promise<EncoderOptions> {
|
||||
const { resolution, fps, streamNum } = params
|
||||
const { resolution, fps, streamNum, inputBitrate } = params
|
||||
const streamSuffix = streamNum == undefined ? '' : `:${streamNum}`
|
||||
const targetBitrate = getTargetBitrate(resolution, fps)
|
||||
let targetBitrate = getTargetBitrate(resolution, fps)
|
||||
let shouldInitVaapi = (streamNum == undefined || streamNum <= latestStreamNum)
|
||||
|
||||
if (targetBitrate > inputBitrate) {
|
||||
targetBitrate = inputBitrate
|
||||
}
|
||||
|
||||
logger.info(`Building encoder options, received ${JSON.stringify(params)}`)
|
||||
|
||||
if (shouldInitVaapi && streamNum != undefined) {
|
||||
@ -194,11 +198,15 @@ async function vodBuilder(params: EncoderOptionsBuilderParams) : Promise<Encoder
|
||||
|
||||
|
||||
async function liveBuilder(params: EncoderOptionsBuilderParams) : Promise<EncoderOptions> {
|
||||
const { resolution, fps, streamNum } = params
|
||||
const { resolution, fps, streamNum, inputBitrate } = params
|
||||
const streamSuffix = streamNum == undefined ? '' : `:${streamNum}`
|
||||
const targetBitrate = getTargetBitrate(resolution, fps)
|
||||
let targetBitrate = getTargetBitrate(resolution, fps)
|
||||
let shouldInitVaapi = (streamNum == undefined || streamNum <= latestStreamNum)
|
||||
|
||||
if (targetBitrate > inputBitrate) {
|
||||
targetBitrate = inputBitrate
|
||||
}
|
||||
|
||||
logger.info(`Building encoder options, received ${JSON.stringify(params)}`)
|
||||
|
||||
if (shouldInitVaapi && streamNum != undefined) {
|
||||
|
Loading…
Reference in New Issue
Block a user