ActivityPub-federated video streaming platform using P2P directly in your web browser
Ensure ffmpeg is killed
Chocobozzz1a5c4ff11d17
diff --git a/packages/ffmpeg/src/ffmpeg-command-wrapper.ts b/packages/ffmpeg/src/ffmpeg-command-wrapper.tsindex 4c11aaac7b..a2f464d68d 100644--- a/packages/ffmpeg/src/ffmpeg-command-wrapper.ts+++ b/packages/ffmpeg/src/ffmpeg-command-wrapper.ts@@ -119,7 +119,9 @@ export class FFmpegCommandWrapper {return new Promise<void>((res, rej) => {let shellCommand: string- this.command.on('start', cmdline => { shellCommand = cmdline })+ this.command.on('start', cmdline => {+ shellCommand = cmdline+ })this.command.on('error', (err: Error & { stdout?: string, stderr?: string }, stdout, stderr) => {if (silent !== true) this.logger.error('Error in ffmpeg.', { err, stdout, stderr, shellCommand, ...this.lTags })@@ -166,12 +168,14 @@ export class FFmpegCommandWrapper {// Run encoder builder depending on available encoders// Try encoders by priority: if the encoder is available, run the chosen profile or fallback to the default one// If the default one does not exist, check the next encoder- async getEncoderBuilderResult (options: EncoderOptionsBuilderParams & {- streamType: 'video' | 'audio'- input: string+ async getEncoderBuilderResult (+ options: EncoderOptionsBuilderParams & {+ streamType: 'video' | 'audio'+ input: string- videoType: 'vod' | 'live'- }) {+ videoType: 'vod' | 'live'+ }+ ) {if (!this.availableEncoders) {throw new Error('There is no available encoders')}diff --git a/packages/ffmpeg/src/ffmpeg-container.ts b/packages/ffmpeg/src/ffmpeg-container.tsindex 6c4d840e6b..a3399f186a 100644--- a/packages/ffmpeg/src/ffmpeg-container.ts+++ b/packages/ffmpeg/src/ffmpeg-container.ts@@ -30,4 +30,10 @@ export class FFmpegContainer {return this.commandWrapper.runCommand({ silent: !logError })}++ forceKill () {+ if (!this.commandWrapper) return++ this.commandWrapper.getCommand().kill('SIGKILL')+ }}diff --git a/server/core/lib/video-file.ts b/server/core/lib/video-file.tsindex 9f74801839..2a6dde2f05 100644--- a/server/core/lib/video-file.ts+++ b/server/core/lib/video-file.ts@@ -303,8 +303,10 @@ export async function muxToMergeVideoFiles (options: {logger.info(`Muxing files for video ${video.url}`, { inputs: inputsToLog, ...lTags(video.uuid) })+ const ffmpegContainer = new FFmpegContainer(getFFmpegCommandWrapperOptions('vod'))+try {- await new FFmpegContainer(getFFmpegCommandWrapperOptions('vod')).mergeInputs({+ await ffmpegContainer.mergeInputs({inputs,output,logError: false,@@ -329,6 +331,8 @@ export async function muxToMergeVideoFiles (options: {}throw err+ } finally {+ ffmpegContainer.forceKill()}} finally {for (const destination of tmpDestinations) {