Adding this event handler solved my issue. Process is stopped crashing, just print the error
ffmpeg.stdin.on('error', (stdinError: any) => {
// This error means ffmpeg's stdin pipe closed unexpectedly.
cleanup(true, new Error(`FFmpeg stdin error: ${stdinError.message}`));
});
Now in logs I see something like this:
Failed to get replay gain volume of the audio file Error: FFmpeg stdin error: write EPIPE