I have a problem with the following code, what I try is that a process calling ffmpeg that runs inside the system is closed giving a warning that the work is finished.
private void btnIniciar_Click(object sender, EventArgs e)
{
btnIniciar.Enabled = false;
btnCancelar.Enabled = true;
Process p = new Process();
ProcessStartInfo psi = new ProcessStartInfo("cmd.exe");
//psi->WindowStyle = ProcessWindowStyle::Hidden;
psi.Arguments = "/k ffmpeg -i " + txtArchivo.Text + " proceso\video.mp4";
p.StartInfo = psi;
p.Start();
Thread.Sleep(1000);
while(procesoFFMPEG())
{
lblEstado.Text = "Estado: En ejecucion...";
}
lblEstado.Text = "Estado: Finalizado";
//p.Kill();
}
public Boolean procesoFFMPEG()
{
if(Process.GetProcessesByName("ffmpeg").Length > 0)
{
return true;
}
else
{
return false;
}
}
The problem is that when you run the program it frizea until the ffmpeg process is closed.
Where am I wrong?
greetings