Handle webp images from youtube-dl
This commit is contained in:
parent
72493e44e9
commit
1878224214
2 changed files with 34 additions and 5 deletions
|
@ -338,11 +338,29 @@ function getClosestFramerateStandard (fps: number, type: 'HD_STANDARD' | 'STANDA
|
|||
.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,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue