ffmpeg produces libraries and programs for handling multimedia. We can convert media files into different formats using ffmpeg. It can also record live streams from a camera in different formats. I am attaching the ffmpeg.exe here. https://www.transferbigfiles.com/a3209f95-ffcc-4c82-b722-041a24c26ec1?rid=KsWHbP3Lo/rxGH4YHVVVtA%3d%3d[^] Here in my code i just copy the audio and video codecs of a file (input.avi) into another file(output.avi). Different parameters can be added in this command, but I just consider the basic operation here.
Process myProcess = new Process();
myProcess.StartInfo.FileName = @"ffmpeg.exe";
myProcess.StartInfo.UseShellExecute = false;
myProcess.StartInfo.RedirectStandardInput = true;
myProcess.StartInfo.Arguments = "-i input.avi -vcodec flv -acodec copy output.flv";
myProcess.Start();
StreamWriter myStreamWriter = myProcess.StandardInput;
myStreamWriter.Write("113"); //using ascii of q
myStreamWriter.Flush();
myStreamWriter.Write('q');
myStreamWriter.Flush();
myStreamWriter.Close();
myProcess.WaitForExit();
myProcess.Close()
;
If i run the pgm ( ffmpeg.exe should be placed in same foldr) it starts the conversion from avi to flv. When I press [q] the pgm gets closed gracefully. But I I am not being able to close it by sending 'q' character or its corresponding ascii. :confused: