I had the same problem today (and on the same platform too)
It's like when you stream you have to specify a format but you cannot specify mp4 because it's not valid
I ended up with this, I think it's a good workaround and I hope it helps:
var input_file = fs.createReadStream(path);
input_file.on('error', function(err) {
console.log(err);
});
var output_path = 'tmp/output.mp4';
var output_stream = fs.createWriteStream('tmp/output.mp4');
var ffmpeg = child_process.spawn('ffmpeg', ['-i', 'pipe:0', '-f', 'mp4', '-movflags', 'frag_keyframe', 'pipe:1']);
input_file.pipe(ffmpeg.stdin);
ffmpeg.stdout.pipe(output_stream);
ffmpeg.stderr.on('data', function (data) {
console.log(data.toString());
});
ffmpeg.stderr.on('end', function () {
console.log('file has been converted succesfully');
});
ffmpeg.stderr.on('exit', function () {
console.log('child process exited');
});
ffmpeg.stderr.on('close', function() {
console.log('...closing time! bye');
});