fluent-ffmpeg / node-fluent-ffmpeg

A fluent API to FFMPEG (http://www.ffmpeg.org)
MIT License
7.85k stars 874 forks source link

Is there a way to hide the command prompt? #1088

Closed Agusacco closed 3 years ago

Agusacco commented 3 years ago

I wanted to know if there was any way to hide the command prompt while converting, because that piece of code runs repeatedly, and it's annoying that the command prompt appears while I'm doing something else.

                ffmpegCommand = ffmpeg();
                var outStream = fs.createWriteStream("audio.mp3");

                await new Promise((resolve, reject) => {

                    ffmpegCommand
                    .setFfmpegPath("C:\\ffmpeg\\bin\\ffmpeg.exe")
                    .format('mp3')
                    .input(stream)
                    .seekInput(arrayEntradas[4][indexEntrada])

                    .output(outStream, { end:true })

                    .on('error', function(err, stdout, stderr) {
                        console.log('Cannot process video: ' + err.message);
                        reject(err);
                    })

                    .on('end', function(stdout, stderr) {
                        console.log('Transcoding succeeded!');
                        resolve();
                    })

                    .on('start', function(commandLine) {
                        console.log('Spawned Ffmpeg with command: ' + commandLine);
                    });

                    if (arrayEntradas[3][indexEntrada] == "1"){

                        ffmpegCommand
                        .audioFilters("bass=g=10", "crystalizer=i=3", "acrusher=.1:1:64:0:log")
                        .duration(5);

                    }

                    else {

                        ffmpegCommand
                        .duration(15)

                    }

                    ffmpegCommand.run();

                });
Agusacco commented 3 years ago

I found a solution. It is a change in the processor.js script. It can be implemented, but my problem only occurs if you are using PM2!

solution