This repository was archived by the owner on May 22, 2025. It is now read-only.
examples/input-stream.js fails with Node 6.8.0 on Ubuntu 16.04 #625
Open
Description
The following code, slightly modified from https://github.com/fluent-ffmpeg/node-fluent-ffmpeg/blob/master/examples/input-stream.js , hangs when using Node 6.8.0 on Ubuntu 16.04.
Generally, any code that passes a readable stream to ffmpeg()
hangs.
The code was modified to 1) show the command line; 2) show progress; and 3) provide specific paths.
The output is:
ffmpeg:start ffmpeg -i pipe:0 -y -b:a 96k -acodec aac -ar 22050 -ac 2 -b:v 512k -vcodec libx264 -r 24 -filter:v scale=w=320:h=trunc(ow/a/2)*2 -f flv ./out.mp4
The input file is http://www.dvdloc8.com/clip.php?movieid=12167&clipid=3 <-- with the media renamed to in.mp4
.
If I run the following command from the cli--or change infs
to './in.mp4'
in the code--it works:
ffmpeg -i pipe:0 -y -b:a 96k -acodec aac -ar 22050 -ac 2 -b:v 512k -vcodec libx264 -r 24 -filter:v scale=w=320:h=trunc(ow/a/2)*2 -f flv ./out.mp4 < in.mp4
The modified code:
var fs = require('fs'),
ffmpeg = require('fluent-ffmpeg');
// open input stream
var infs = fs.createReadStream('./in.mp4');
infs.on('error', function(err) {
console.log(err);
});
// create new ffmpeg processor instance using input stream
// instead of file path (can be any ReadableStream)
var proc = ffmpeg(infs)
.preset('flashvideo')
// setup event handlers
.on('start', function(data) {
console.log('\nffmpeg:start', data);
})
.on('progress', function(data) {
console.log('\nffmpeg:progress', data);
})
.on('end', function() {
console.log('done processing input stream');
})
.on('error', function(err) {
console.log('an error happened: ' + err.message);
})
// save to file
.save('./out.mp4');
Should I try something else?