This repository was archived by the owner on May 22, 2025. It is now read-only.
NodeJS process crash when killing ffmpeg instance #861
Open
Description
- fluent-ffmpeg version: 2.1.2
- ffmpeg version: ffmpeg static 2.3 from https://www.npmjs.com/package/ffmpeg-static
- OS: Debian 9
I am using ffmpeg for screenshot generation and video transcoding on many servers. Sometimes a task doesn't finish, so I added a code to abort it using setTimeout()
let commandObj = FfmpegCommand(..);
setTimeout(() => {
commandObj.kill("SIGKILL");
}, 10000);
This works 99% of the time, however sometimes I get crashes with stacktraces telling me that stdErr is undefined
TypeError: Cannot read property 'get' of undefined", "
at endCB (/home/staydown/nodejs/SD_Inspector/SpiderManager/node_modules/fluent-ffmpeg/lib/processor.js:544:37)", "
at ChildProcess.<anonymous> (/home/staydown/nodejs/SD_Inspector/SpiderManager/node_modules/fluent-ffmpeg/lib/processor.js:159:9)", "
at ChildProcess.emit (events.js:182:13)", "
at Process.ChildProcess._handle.onexit (internal/child_process.js:235:12)", "
at onErrorNT (internal/child_process.js:406:16)", " at process._tickCallback (internal/process/next_tick.js:63:19)"
Since the lines above 159 already check for process exit, I suggest adding a check if stdErr is undefined or a try-catch.