added input options to enable vaapi, override default bf value, add video filter

This commit is contained in:
Théo Le Calvar 2021-04-04 01:35:16 +02:00
parent 7d60dc2120
commit f77c42ebde

21
main.js
View File

@ -7,23 +7,30 @@ async function register ({
const builder = (options) => { const builder = (options) => {
const { input, resolution, fps, streamNum } = options const { input, resolution, fps, streamNum } = options
const streamString = streamNum ? ':' + streamNum : ''
console.log(options);
// You can also return a promise // You can also return a promise
return { return {
videoFilters: [
'hwupload'
],
inputOptions: [
// enable hardware acceleration
'-hwaccel vaapi',
'-hwaccel_output_format vaapi',
'-vaapi_device /dev/dri/renderD128'
],
outputOptions: [ outputOptions: [
// enable hardware acceleration '-bf 8', // override hardcoded bf value which cause memory error
'-hwaccel vaapi -hwaccel_output_format vaapi -vaapi_device /dev/dri/renderD128' '-pix_fmt vaapi_vld'
] ]
} }
} }
const encoder = 'libx264' const encoder = 'h264_vaapi'
const profileName = 'foobarbaz' const profileName = 'vaapi'
// Support this profile for VOD transcoding // Support this profile for VOD transcoding
transcodingManager.addVODProfile(encoder, profileName, builder) transcodingManager.addVODProfile(encoder, profileName, builder)
transcodingManager.addVODEncoderPriority('video', encoder, 1000)
// And/Or support this profile for live transcoding // And/Or support this profile for live transcoding
transcodingManager.addLiveProfile(encoder, profileName, builder) transcodingManager.addLiveProfile(encoder, profileName, builder)