damianociarla / node-ffmpeg

ffmpeg module for nodejs
MIT License
600 stars 140 forks source link

[ERR_CHILD_PROCESS_STDIO_MAXBUFFER]: stderr maxBuffer length exceeded #81

Closed marcraft2 closed 2 years ago

marcraft2 commented 3 years ago

Hello, I ran into this problem with this lib. On a not very powerful machine. Because my assembly was very long, more than 3 hours.

Bypass problem :

Add line on : node-ffmpeg/lib/utils.js

On my device :

node_modules/ffmpeg/lib/utils.js

[...] (line 10 on utils.js)
module.exports.exec = function (commands, settings, callback) {
    // Create final command line
    var finalCommand = commands.join(" ");
    // Create the timeoutId for stop the timeout at the end the process
    var timeoutID = null;

        // -------------------------------------HERE---------------------------
        settings.maxBuffer = 1024*1024*50        //Default of child_process lib is : 1024*1024
        // -------------------------------------HERE---------------------------

    // Exec the command
    var process = exec(finalCommand, settings, function (error, stdout, stderr) {
        // Clear timeout if 'timeoutID' are setted
        if (timeoutID !== null) clearTimeout(timeoutID);
        // Call the callback function
        callback(error, stdout, stderr);
    });
    // Verify if the timeout are setting
    if (settings.timeout > 0) {
        // Set the timeout
        timeoutID = setTimeout(function () {
            process.kill();
        }, 100);
    }
}
[...]

src : https://nodejs.org/api/child_process.html#child_process_child_process_exec_command_options_callback

The best would be to add the possibility to set this value, or to calculate the most probable value if possible.

CarlosFloresSpoke commented 2 years ago

hi, i have the same problem, could you help me? how did you resolve?

joshverd commented 1 year ago

This PR has the correct fix for this issue: https://github.com/damianociarla/node-ffmpeg/pull/82

For anyone that comes across this issue in the future, I posted a comment on that PR explaining how I fixed it.