`
var ffmpeg = require('fluent-ffmpeg'),
fs = require('fs'),
write = fs.createWriteStream('./2.wav');
ffmpeg('./123.mp3').audioCodec('pcm_s16le')
.audioBitrate(128)
.audioChannels(1)
.audioFrequency(16000)
.pipe(write)
.on('error', function(err) {
console.log('An error occurred: ' + err.message);
})
.on('end', function() {
console.log('Processing finished !');
})`
events.js:182
throw er; // Unhandled 'error' event
^
Error: ffmpeg exited with code 1: pipe:1: Invalid argument
at ChildProcess.<anonymous> (D:\gitHub\redsBack\node_modules\fluent-ffmpeg\l
ib\processor.js:186:22)
at emitTwo (events.js:125:13)
at ChildProcess.emit (events.js:213:7)
at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
When using pipes, you need to tell ffmpeg which format you are using.
Just add .format('wav') and you should be good to go.
Closing, @konnextv has the right answer.
Similar old issue with the same solution: https://github.com/fluent-ffmpeg/node-fluent-ffmpeg/issues/337#issuecomment-62901962.
Most helpful comment
When using pipes, you need to tell ffmpeg which format you are using.
Just add .format('wav') and you should be good to go.