Answer the question
In order to leave comments, you need to log in
How to keep child_process.stdin permanently open?
Hello. There is a node, there is ffmpeg. You need to convert pieces of video into one as they arrive. That is, at intervals, check whether new ones have appeared and insert them into the queue for conversion.
Actually I start ffmpeg:
var args = ['-i', 'pipe:0', '-f', 'mp4', '-movflags', 'frag_keyframe', 'pipe:1'];
var ffmpeg = spawn('C:/ffmpeg/bin/ffmpeg.exe', args);
var output_file = fs.createWriteStream('./compiled/output.mp4');
ffmpeg.stdout.pipe(output_file);
funtion pipeNewFile(){
var file = files.shift();
if(!file){return;}
var newReadStream = fs.createReadStream(file);
newReadStream.pipe(ffmpeg.stdin);
newReadStream.on('end',function(){
pipeNewFile();
});
}
Answer the question
In order to leave comments, you need to log in
https://nodejs.org/api/stream.html#stream_readable...newReadStream.pipe(ffmpeg.stdin, { end: false });
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question