aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/helpers/ffmpeg-utils.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2020-07-10 14:54:11 +0200
committerChocobozzz <me@florianbigard.com>2020-07-10 14:54:11 +0200
commit187822421489ae811d118d15aa2d8361183250c2 (patch)
treebe429819c049384819fde76df33d46f4886d8ad1 /server/helpers/ffmpeg-utils.ts
parent72493e44e9b455a04c4f093ed6c6ffa300b98d8b (diff)
downloadPeerTube-187822421489ae811d118d15aa2d8361183250c2.tar.gz
PeerTube-187822421489ae811d118d15aa2d8361183250c2.tar.zst
PeerTube-187822421489ae811d118d15aa2d8361183250c2.zip
Handle webp images from youtube-dl
Diffstat (limited to 'server/helpers/ffmpeg-utils.ts')
-rw-r--r--server/helpers/ffmpeg-utils.ts18
1 files changed, 18 insertions, 0 deletions
diff --git a/server/helpers/ffmpeg-utils.ts b/server/helpers/ffmpeg-utils.ts
index 557fb5e3a..0cfc51775 100644
--- a/server/helpers/ffmpeg-utils.ts
+++ b/server/helpers/ffmpeg-utils.ts
@@ -338,11 +338,29 @@ function getClosestFramerateStandard (fps: number, type: 'HD_STANDARD' | 'STANDA
338 .sort((a, b) => fps % a - fps % b)[0] 338 .sort((a, b) => fps % a - fps % b)[0]
339} 339}
340 340
341function convertWebPToJPG (path: string, destination: string): Promise<void> {
342 return new Promise<void>(async (res, rej) => {
343 try {
344 const command = ffmpeg(path).output(destination)
345
346 command.on('error', (err, stdout, stderr) => {
347 logger.error('Error in ffmpeg webp convert process.', { stdout, stderr })
348 return rej(err)
349 })
350 .on('end', () => res())
351 .run()
352 } catch (err) {
353 return rej(err)
354 }
355 })
356}
357
341// --------------------------------------------------------------------------- 358// ---------------------------------------------------------------------------
342 359
343export { 360export {
344 getVideoStreamCodec, 361 getVideoStreamCodec,
345 getAudioStreamCodec, 362 getAudioStreamCodec,
363 convertWebPToJPG,
346 getVideoStreamSize, 364 getVideoStreamSize,
347 getVideoFileResolution, 365 getVideoFileResolution,
348 getMetadataFromFile, 366 getMetadataFromFile,