0

I have started the VLC player in my application using this code:

Process.Start("C://Program Files//Videolan//VLC//VLC.exe", "\"rtsp://xxx.xxx.xx.xx:554/h264\" --qt-start-minimized --sout=#transcode{vcodec=theo,vb=800,acodec=flac,ab=128,channels=2,samplerate=44100}:file{dst=C:\\123.ogg,no-overwrite}");

Now I need to stop/close this. Please advice.

Vinshi
  • 313
  • 2
  • 7
  • 27

2 Answers2

3

Process.Kill(); should do the trick.

A somewhat gentler way would be Process.CloseMainWindow, but depends on implementation.

Reference: Process.Kill Method (MSDN).

Jimmy
  • 27,142
  • 5
  • 87
  • 100
OnoSendai
  • 3,960
  • 2
  • 22
  • 46
0

You can kill by using the following code

try
{   
    foreach (Process proc in Process.GetProcessesByName("processname"))
    {
        proc.Kill();
    }
}
catch(Exception ex)
{

}
Sriram Sakthivel
  • 72,067
  • 7
  • 111
  • 189
Durai
  • 542
  • 3
  • 4