From 7d60dc21205162df0e9e945b7252a7e493836404 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9o=20Le=20Calvar?= Date: Tue, 30 Mar 2021 19:25:24 +0200 Subject: [PATCH] initial commit --- main.js | 40 ++++++++++++++++++++++++++++++++++++++++ package.json | 21 +++++++++++++++++++++ 2 files changed, 61 insertions(+) create mode 100644 main.js create mode 100644 package.json 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