Node.js & avconv — real-time video conversion -


i'm working on real-time video conversion demo app. video file parsed node-multiparty, file's part piped avconv.stdin , when processed, chunk pipes write stream.

here's part of source code:

var form = new multiparty.form(),     args = ['-i', 'pipe:0', '-f', 'webm', 'pipe:1'],     avconv = spawn('avconv', args),     output = fs.createwritestream(filepath);  form.on('part', function (part) {   if (part.filename) {     part.pipe(avconv.stdin);      part.on('end', function() {       console.log('===== video has been uploaded! =====');       avconv.stdin.end();     });   } });  avconv.stdout.pipe(output); 

i'm interested in end event attached file's part. event should fired when part parsed, means has been uploaded.

i have test video file (~800kb) , low-level laptop testing. while running test on localhost, end event firing @ end of avconv conversion process, lasts ~15s.

800kb video file has been uploaded way faster, looks part stream still not empty waiting data processed avconv.

am right or there's thing?

you absolutely right. readable stream emits end event when totally consumed. have here: http://nodejs.org/api/stream.html#stream_event_end


Comments

Popular posts from this blog

python - Subclassed QStyledItemDelegate ignores Stylesheet -

java - HttpClient 3.1 Connection pooling vs HttpClient 4.3.2 -

SQL: Divide the sum of values in one table with the count of rows in another -