Answer the question
In order to leave comments, you need to log in
How to set path in process.child?
Is it possible to run ffmpeg from a .js file if it is in the program folder? I'm trying to run, but I don't know how to specify that I need to use ffmpeg.exe. How to use __dirname + '/ffmpeg/bin/ffmpeg.exe' instead of putting ffmpeg command in $PATH for command line?
const command = spawn('ffmpeg', [
'-f', 'gdigrab',
'-i', 'desktop',
// '-f', 'dshow',
// '-i', 'video=\"screen-capture-recorder\"',
'-preset', 'ultrafast',
'-vcodec', 'libx264',
'-tune', 'zerolatency',
'-b', '900k',
'-c:a', 'aac',
'-ar', '44100',
'-f', 'flv',
'rtmp://localhost/live/STREAM_NAME'
]);
command.stdout.on('data', (data) => {
console.log(`stdout: ${data}`);
});
command.stderr.on('data', (data) => {
console.log(`stderr: ${data}`);
});
command.on('close', (code) => {
console.log(`child process exited with code ${code}`);
});
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question