Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
ffmpeg.getAvailableCodecs((err, codecs) => {
ffmpeg.getAvailableCodecs((err, codecs) => {
console.log('Available read codecs:');
for (const k in codecs) {
if(codecs[k].canDecode) {
console.log(` - ${k}`);
}
}
return deferred.resolve();
});
});
}
async (req, res, next) => {
try {
const promisify = (fn) =>
new Promise((resolve, reject) =>
fn((err, data) => err ? reject(err) : resolve(data)));
const [
formats, codecs, encoders, filters, postcount, boardcount, spaceused
] = await Promise.all([
promisify(ffmpeg.getAvailableFormats),
promisify(ffmpeg.getAvailableCodecs),
promisify(ffmpeg.getAvailableEncoders),
promisify(ffmpeg.getAvailableFilters),
Post.estimatedDocumentCount(),
Board.estimatedDocumentCount(),
new Promise((resolve, reject) => {
du(config.html_path, (err, size) => {
if (err) {
reject(err);
return;
}
resolve(size);
});
}),
]);
const ffmpegPath = process.env.FFMPEG_PATH;
const getCodecSupport = () => new Promise((resolve, reject) => {
try {
const useCodecs = { video: 'libx264' }
ffmpeg.getAvailableCodecs((err, codecs) => {
if (codecs['libfdk_aac']) {
if (codecs['libfdk_aac'].canEncode === true) {
useCodecs.audio = 'libfdk_aac'
resolve(useCodecs)
} else {
useCodecs.audio = 'aac'
resolve(useCodecs)
}
} else {
useCodecs.audio = 'aac'
resolve(useCodecs)
}
})
} catch (err) { reject(err.stack || err) }
})