aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/helpers/ffmpeg-utils.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-03-03 10:23:05 +0100
committerChocobozzz <me@florianbigard.com>2021-03-03 10:23:05 +0100
commitcd2c3dcdc4a626a8a185b359cc40b53c8e8e0e7e (patch)
treeffba9b24c4a677f5199c31be7d2185eadcbaae00 /server/helpers/ffmpeg-utils.ts
parentdcd75f786c42b4cc2049b17d535b3de3b7702fbc (diff)
downloadPeerTube-cd2c3dcdc4a626a8a185b359cc40b53c8e8e0e7e.tar.gz
PeerTube-cd2c3dcdc4a626a8a185b359cc40b53c8e8e0e7e.tar.zst
PeerTube-cd2c3dcdc4a626a8a185b359cc40b53c8e8e0e7e.zip
Remove unnecessary transcoding job error
Diffstat (limited to 'server/helpers/ffmpeg-utils.ts')
-rw-r--r--server/helpers/ffmpeg-utils.ts17
1 files changed, 12 insertions, 5 deletions
diff --git a/server/helpers/ffmpeg-utils.ts b/server/helpers/ffmpeg-utils.ts
index 33c625c9e..620025966 100644
--- a/server/helpers/ffmpeg-utils.ts
+++ b/server/helpers/ffmpeg-utils.ts
@@ -69,7 +69,7 @@ function convertWebPToJPG (path: string, destination: string): Promise<void> {
69 const command = ffmpeg(path, { niceness: FFMPEG_NICE.THUMBNAIL }) 69 const command = ffmpeg(path, { niceness: FFMPEG_NICE.THUMBNAIL })
70 .output(destination) 70 .output(destination)
71 71
72 return runCommand(command) 72 return runCommand({ command, silent: true })
73} 73}
74 74
75function processGIF ( 75function processGIF (
@@ -82,7 +82,7 @@ function processGIF (
82 .size(`${newSize.width}x${newSize.height}`) 82 .size(`${newSize.width}x${newSize.height}`)
83 .output(destination) 83 .output(destination)
84 84
85 return runCommand(command) 85 return runCommand({ command })
86} 86}
87 87
88async function generateImageFromVideoFile (fromPath: string, folder: string, imageName: string, size: { width: number, height: number }) { 88async function generateImageFromVideoFile (fromPath: string, folder: string, imageName: string, size: { width: number, height: number }) {
@@ -201,7 +201,7 @@ async function transcode (options: TranscodeOptions) {
201 201
202 command = await builders[options.type](command, options) 202 command = await builders[options.type](command, options)
203 203
204 await runCommand(command, options.job) 204 await runCommand({ command, job: options.job })
205 205
206 await fixHLSPlaylistIfNeeded(options) 206 await fixHLSPlaylistIfNeeded(options)
207} 207}
@@ -649,10 +649,17 @@ function getFFmpeg (input: string, type: 'live' | 'vod') {
649 return command 649 return command
650} 650}
651 651
652async function runCommand (command: ffmpeg.FfmpegCommand, job?: Job) { 652async function runCommand (options: {
653 command: ffmpeg.FfmpegCommand
654 silent?: boolean // false
655 job?: Job
656}) {
657 const { command, silent = false, job } = options
658
653 return new Promise<void>((res, rej) => { 659 return new Promise<void>((res, rej) => {
654 command.on('error', (err, stdout, stderr) => { 660 command.on('error', (err, stdout, stderr) => {
655 logger.error('Error in transcoding job.', { stdout, stderr }) 661 if (silent !== true) logger.error('Error in ffmpeg.', { stdout, stderr })
662
656 rej(err) 663 rej(err)
657 }) 664 })
658 665