0

I just use VLC to broadcast a ts content with the 5M bps through udp, and using the following Nodejs codes to recieve the data and output them to stdout:

var socket = require( "dgram" ).createSocket( "udp4" );
var fs = require('fs');
// Listen messages
socket.on(
    "message",
    function ( message, requestInfo ) {
        process.stdout.write(message);
    }
);
...

The problem is: it seems the pipe's speed can't meet 5M bps. I have check the output data from the pipe of stdout and found some of the data missed. I just wander if the pipe can't support the throughput more than 5Mbps? Does anybody can give some suggestions? Thanks ahead.

BTW: OS: win7; Nodejs version: 0.10.33

  • 1
    Seems to me that writing to [stdout is just plain slow](http://stackoverflow.com/questions/3857052/why-is-printing-to-stdout-so-slow-can-it-be-sped-up) and it's not node's piping that is to blame. I don't really have an answer to your problem, but perhaps you can buffer the output and [write in larger chunks](http://ffmpeg.org/pipermail/ffmpeg-user/2012-August/008904.html)? – RickN Nov 11 '14 at 12:13
  • Thanks for your response. I just want to use pipe connect several executable program. So after this program, another program will receive data from stdin and to process them. – Hongfee Mo Nov 11 '14 at 20:55
  • Perhaps (no idea if it'll help) you can try to buffer incoming data, until the buffer is say, 1mb or 4mb and then do `process.stdout.write`. Or, if the other executables in your chain are written in node, embed them in your main app and use node's pipes (`someReadableStream.pipe(someWritableStream)`, instead of using Windows pipes. – RickN Nov 12 '14 at 10:26

0 Answers0