commit 7d60dc21205162df0e9e945b7252a7e493836404 Author: Théo Le Calvar Date: Tue Mar 30 19:25:24 2021 +0200 initial commit diff --git a/main.js b/main.js new file mode 100644 index 0000000..c0c9221 --- /dev/null +++ b/main.js @@ -0,0 +1,40 @@ +async function register ({ + transcodingManager +}) { + + // Adapt bitrate when using libx264 encoder + { + const builder = (options) => { + const { input, resolution, fps, streamNum } = options + + const streamString = streamNum ? ':' + streamNum : '' + + console.log(options); + // You can also return a promise + return { + outputOptions: [ + // enable hardware acceleration + '-hwaccel vaapi -hwaccel_output_format vaapi -vaapi_device /dev/dri/renderD128' + ] + } + } + + const encoder = 'libx264' + const profileName = 'foobarbaz' + + // Support this profile for VOD transcoding + transcodingManager.addVODProfile(encoder, profileName, builder) + + // And/Or support this profile for live transcoding + transcodingManager.addLiveProfile(encoder, profileName, builder) + } +} + +async function unregister() { + return true; +} + +module.exports = { + register, + unregister +} diff --git a/package.json b/package.json new file mode 100644 index 0000000..cbb601b --- /dev/null +++ b/package.json @@ -0,0 +1,21 @@ +{ + "name": "peertube-plugin-hardware-transcode-vaapi", + "version": "0.0.1", + "description": "Plugin add transcode profils which use vaapi for hardware acceleration", + "engine": { + "peertube": ">=3.1.0" + }, + "keywords": [ + "peertube", + "plugin" + ], + "homepage": "https://git.kher.nl/tlc/peertube-plugin-hardware-transcode-vaapi", + "author": "gdsn", + "bugs": "https://git.kher.nl/tlc/peertube-plugin-hardware-transcode-vaapi", + "library": "./main.js", + "staticDirs": {}, + "css": [], + "clientScripts": [], + "translations": {} + } + \ No newline at end of file