Skip to content
This repository was archived by the owner on May 22, 2025. It is now read-only.

Process is not killing it self on error (or Timeout).ย #482

Open
@mh4ck

Description

@mh4ck

The ffmpeg process is not killing itself on an error the error event, and kill() is not working.
Does anybody know how to fix this?

I think the processes stay available on reaching the timeout.
After a timeout the 'error' event is called, in this i kill the process but the process in linux "ps"
is still available.

Is there another way to get the process id or something to kill it?

var ffmpegProc = new ffmpeg({source:videoPath, timeout: 20})
                  .duration(900) //15 min
                  .format('mp3')
                  .on('error', function(err, stdout, stderr) {

                    activeConversions--;
                    fs.exists(videoPath, function(exists) {

                      if(exists) {

                       fs.unlink(videoPath, exports.handleError);
                      }
                    });
                    if(!_.isUndefined(currentConversions[id]))delete currentConversions[id];
                    if(!_.isUndefined(ffmpegProc.kill))ffmpegProc.kill();
                    exports.handleError({err:err});
                  })
                  .on('start', function(pinfo) {

                    activeConversions++;
                    currentConversions[id] = {
                      progressName: 'Converting to MP3', 
                      progressValue: 0, 
                      title: info.title
                    };
                  })
                  .on('end', function() {

                    activeConversions--;
                    fs.exists(videoPath, function(exists) {

                      if(exists) {

                       fs.unlink(videoPath, exports.handleError);
                      }
                    });
                    if(!_.isUndefined(currentConversions[id]))delete currentConversions[id];
                  })
                  .pipe(writeStream, {end: true});

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions