private void buttonCancel_Click(object sender, EventArgs e) { cancelTwoPass = true; if (!processEnded || processPanic) { if (!ffmpegProcess.HasExited) { ffmpegProcess.Kill(); } } else { Close(); } }