Created
December 21, 2012 07:45
-
-
Save kanryu/4351283 to your computer and use it in GitHub Desktop.
Revisions
-
kanryu created this gist
Dec 21, 2012 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,37 @@ //// problem: node.js make memory leaks about child_proces // // the javascript doing it tha same to the shell code // $ cat mako_* | ./ffmpeg -y -f image2pipe -r 1 -vcodec bmp -r 29.7 -i - -vcodec utvideo movie.avi var ffmpeg = require('basicFFmpeg'); var fs = require('fs'); var sprintf = require('sprintf').sprintf; var spawn = require('child_process').spawn, exec = require('child_process').exec; function genProcArgs(processor) { var args = ['-y', '-f', 'image2pipe', '-r', '1', '-vcodec', 'bmp', '-r', '29.7', '-i', '-', '-vcodec', 'utvideo', '-f', 'avi']; // args.push('pipe:1'); args.push("test.avi"); return args; } var proc = spawn('ffmpeg', genProcArgs()); for(var j = 0; j < 1000; j++) { for(var i = 0; i <= 12; i++) { var path = sprintf("mako_%04d.bmp", i); var data = fs.readFileSync(path); console.log(j, i); // 1. writing out to ffmpeg process, occars memory leaks proc.stdin.write(data); //// 2. writing out to a local file, no memory leaks // fs.appendFileSync("m.bmp", data); } } proc.stdin.end();