diff options
author | Chocobozzz <me@florianbigard.com> | 2021-01-28 15:52:44 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-01-28 15:55:39 +0100 |
commit | 1896bca09e088b0da9d5e845407ecebae330618c (patch) | |
tree | 56041c445c0cd49aca536d0fd6b586730f4d341e /server/initializers/checker-before-init.ts | |
parent | 529b37527cff5203a0689a15ce73dcee6e1eece2 (diff) | |
download | PeerTube-1896bca09e088b0da9d5e845407ecebae330618c.tar.gz PeerTube-1896bca09e088b0da9d5e845407ecebae330618c.tar.zst PeerTube-1896bca09e088b0da9d5e845407ecebae330618c.zip |
Support transcoding options/encoders by plugins
Diffstat (limited to 'server/initializers/checker-before-init.ts')
-rw-r--r-- | server/initializers/checker-before-init.ts | 29 |
1 files changed, 0 insertions, 29 deletions
diff --git a/server/initializers/checker-before-init.ts b/server/initializers/checker-before-init.ts index 7945e8586..9c4e0048a 100644 --- a/server/initializers/checker-before-init.ts +++ b/server/initializers/checker-before-init.ts | |||
@@ -97,34 +97,6 @@ async function checkFFmpeg (CONFIG: { TRANSCODING: { ENABLED: boolean } }) { | |||
97 | throw new Error('Unavailable encode codec ' + codec + ' in FFmpeg') | 97 | throw new Error('Unavailable encode codec ' + codec + ' in FFmpeg') |
98 | } | 98 | } |
99 | } | 99 | } |
100 | |||
101 | return checkFFmpegEncoders() | ||
102 | } | ||
103 | |||
104 | // Detect supported encoders by ffmpeg | ||
105 | let supportedEncoders: Map<string, boolean> | ||
106 | async function checkFFmpegEncoders (): Promise<Map<string, boolean>> { | ||
107 | if (supportedEncoders !== undefined) { | ||
108 | return supportedEncoders | ||
109 | } | ||
110 | |||
111 | const Ffmpeg = require('fluent-ffmpeg') | ||
112 | const getAvailableEncodersPromise = promisify0(Ffmpeg.getAvailableEncoders) | ||
113 | const availableEncoders = await getAvailableEncodersPromise() | ||
114 | |||
115 | const searchEncoders = [ | ||
116 | 'aac', | ||
117 | 'libfdk_aac', | ||
118 | 'libx264' | ||
119 | ] | ||
120 | |||
121 | supportedEncoders = new Map<string, boolean>() | ||
122 | |||
123 | for (const searchEncoder of searchEncoders) { | ||
124 | supportedEncoders.set(searchEncoder, availableEncoders[searchEncoder] !== undefined) | ||
125 | } | ||
126 | |||
127 | return supportedEncoders | ||
128 | } | 100 | } |
129 | 101 | ||
130 | function checkNodeVersion () { | 102 | function checkNodeVersion () { |
@@ -143,7 +115,6 @@ function checkNodeVersion () { | |||
143 | 115 | ||
144 | export { | 116 | export { |
145 | checkFFmpeg, | 117 | checkFFmpeg, |
146 | checkFFmpegEncoders, | ||
147 | checkMissedConfig, | 118 | checkMissedConfig, |
148 | checkNodeVersion | 119 | checkNodeVersion |
149 | } | 120 | } |