BlenderRenderController.MainForm.concatenatePartsButton_Click C# (CSharp) Method

concatenatePartsButton_Click() private method

private concatenatePartsButton_Click ( object sender, EventArgs e ) : void
sender object
e System.EventArgs
return void
        private void concatenatePartsButton_Click(object sender, EventArgs e)
        {
            StreamWriter partListWriter = new StreamWriter(outFolderPath + "\\partList.txt");
			string       fileExtension  = "mp4";
			List<string> stringPartList = findFiles( outFolderPath, "*.mp4" );
			string       audioFile      = Path.GetFileNameWithoutExtension( blendFilePathTextBox.Text );
			string       audioSettings  = string.Empty;//"-c:a aac -b:a 256k";

			//Fall back to seraching for .avi files instead
			if( stringPartList == null || stringPartList.Count == 0 ) {
				stringPartList = findFiles( outFolderPath, "*.avi" );
				fileExtension = "avi";
			}

			if( File.Exists( Path.Combine( outFolderPath, audioFile + ".ac3" ) ) ) {
				audioFile = " -i " + audioFile + ".ac3";
			}
			else {
				audioFile     = string.Empty;
				audioSettings = string.Empty;
			}

            stringPartList.Sort(compareParts);

            foreach (var currentPart in stringPartList)
            {
                partListWriter.WriteLine("file '{0}'", Path.GetFileName( currentPart ) );
            }

            partListWriter.Close();


            Process p = new Process();

            p.StartInfo.WorkingDirectory = outFolderPath;
            p.StartInfo.FileName = "ffmpeg";
			p.StartInfo.WindowStyle = ProcessWindowStyle.Minimized;

			p.StartInfo.Arguments = String.Format( "-f concat -i partList.txt {0} -c:v copy {1} concat_output.{2}",
												   audioFile,
												   audioSettings,
												   fileExtension
								    );
            
			p.Start();

        }