Skip to content

Commit 2bb10ee

Browse files
committed
feat: support spawn options for ffmpeg as per fluent-ffmpeg#1073
1 parent 495600a commit 2bb10ee

File tree

1 file changed

+22
-6
lines changed

1 file changed

+22
-6
lines changed

lib/processor.js

+22-6
Original file line numberDiff line numberDiff line change
@@ -431,15 +431,17 @@ module.exports = function(proto) {
431431
return emitEnd(err);
432432
}
433433

434+
const options = Object.assign({
435+
captureStdout: !outputStream,
436+
niceness: self.options.niceness,
437+
cwd: self.options.cwd,
438+
windowsHide: true
439+
}, self.options.processOptions || {});
440+
434441
// Run ffmpeg
435442
self._spawnFfmpeg(
436443
args,
437-
{
438-
captureStdout: !outputStream,
439-
niceness: self.options.niceness,
440-
cwd: self.options.cwd,
441-
windowsHide: true
442-
},
444+
options,
443445

444446
function processCB(ffmpegProc, stdoutRing, stderrRing) {
445447
self.ffmpegProc = ffmpegProc;
@@ -640,6 +642,20 @@ module.exports = function(proto) {
640642
return this;
641643
};
642644

645+
/**
646+
* Add process options to spawn
647+
*
648+
* @method FfmpegCommand#withProcessOptions
649+
* @category Processing
650+
*
651+
* @see [child_process.spawn](https://nodejs.org/api/child_process.html#child_process_child_process_spawn_command_args_options)
652+
* @return FfmpegCommand
653+
*/
654+
proto.withProcessOptions = function(options) {
655+
options = options || {};
656+
this.options.processOptions = options;
657+
return this;
658+
};
643659

644660
/**
645661
* Kill current ffmpeg process, if any

0 commit comments

Comments
 (0)