}
}
-function computeResolutionsToTranscode (videoFileHeight: number) {
+function computeResolutionsToTranscode (videoFileResolution: number) {
const resolutionsEnabled: number[] = []
const configResolutions = CONFIG.TRANSCODING.RESOLUTIONS
]
for (const resolution of resolutions) {
- if (configResolutions[resolution + 'p'] === true && videoFileHeight > resolution) {
+ if (configResolutions[resolution + 'p'] === true && videoFileResolution > resolution) {
resolutionsEnabled.push(resolution)
}
}
.sort((a, b) => fps % a - fps % b)[0]
}
+function convertWebPToJPG (path: string, destination: string): Promise<void> {
+ return new Promise<void>(async (res, rej) => {
+ try {
+ const command = ffmpeg(path).output(destination)
+
+ command.on('error', (err, stdout, stderr) => {
+ logger.error('Error in ffmpeg webp convert process.', { stdout, stderr })
+ return rej(err)
+ })
+ .on('end', () => res())
+ .run()
+ } catch (err) {
+ return rej(err)
+ }
+ })
+}
+
// ---------------------------------------------------------------------------
export {
getVideoStreamCodec,
getAudioStreamCodec,
+ convertWebPToJPG,
getVideoStreamSize,
getVideoFileResolution,
getMetadataFromFile,