diff options
Diffstat (limited to 'server/initializers')
-rw-r--r-- | server/initializers/checker.js | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/server/initializers/checker.js b/server/initializers/checker.js index a3727563a..aa8dea4bf 100644 --- a/server/initializers/checker.js +++ b/server/initializers/checker.js | |||
@@ -2,10 +2,12 @@ | |||
2 | 2 | ||
3 | const config = require('config') | 3 | const config = require('config') |
4 | 4 | ||
5 | const constants = require('./constants') | ||
5 | const db = require('./database') | 6 | const db = require('./database') |
6 | 7 | ||
7 | const checker = { | 8 | const checker = { |
8 | checkConfig, | 9 | checkConfig, |
10 | checkFFmpeg, | ||
9 | checkMissedConfig, | 11 | checkMissedConfig, |
10 | clientsExist, | 12 | clientsExist, |
11 | usersExist | 13 | usersExist |
@@ -42,6 +44,29 @@ function checkMissedConfig () { | |||
42 | return miss | 44 | return miss |
43 | } | 45 | } |
44 | 46 | ||
47 | // Check the available codecs | ||
48 | function checkFFmpeg (callback) { | ||
49 | const Ffmpeg = require('fluent-ffmpeg') | ||
50 | |||
51 | Ffmpeg.getAvailableCodecs(function (err, codecs) { | ||
52 | if (err) return callback(err) | ||
53 | if (constants.CONFIG.TRANSCODING.ENABLED === false) return callback(null) | ||
54 | |||
55 | const canEncode = [ 'libx264' ] | ||
56 | canEncode.forEach(function (codec) { | ||
57 | if (codecs[codec] === undefined) { | ||
58 | return callback(new Error('Unknown codec ' + codec + ' in FFmpeg.')) | ||
59 | } | ||
60 | |||
61 | if (codecs[codec].canEncode !== true) { | ||
62 | return callback(new Error('Unavailable encode codec ' + codec + ' in FFmpeg')) | ||
63 | } | ||
64 | }) | ||
65 | |||
66 | return callback(null) | ||
67 | }) | ||
68 | } | ||
69 | |||
45 | function clientsExist (callback) { | 70 | function clientsExist (callback) { |
46 | db.OAuthClient.countTotal(function (err, totalClients) { | 71 | db.OAuthClient.countTotal(function (err, totalClients) { |
47 | if (err) return callback(err) | 72 | if (err) return callback(err) |