I have an application that renders several chunks of video dynamically with data from a database and merge them all together at the end. Works good but some times the command line window wont close and that stops the whole process until I manually close it. I thought about placing a timer to force to close the window after some time in case it get stuck, but I guess is not the best way to do it.
Here is an example of the code that renders one of those chunks of video with the help of C#, command line and After Effects.
Process ProcessUnoRender;
ProcessSantaUnoRender = new ProcessStartInfo("cmd.exe", "/K aerender -project C:\\Santa\\temp\\insert1.aep & exit");
ProcessSantaUnoRender.CreateNoWindow = true;
ProcessSantaUnoRender.WindowStyle = ProcessWindowStyle.Normal;
ProcessSantaUnoRender.UseShellExecute = true;
ProcessSantaUnoRender.WorkingDirectory = @"C:\Santa\temp\";
ProcessUnoRender = Process.Start(ProcessSantaUnoRender);
ProcessUnoRender.WaitForExit();
ProcessUnoRender.Close();