protected override async Task <Action <AsyncCodeActivityContext> > ExecuteAsync(AsyncCodeActivityContext context, CancellationToken cancellationToken) { var FFMPEGPath = ffmpegPath.Get(context); var FFMPEGDirectory = FFMPEGPath.Substring(0, FFMPEGPath.LastIndexOf('\\')); FFMPEGPath = '"' + FFMPEGPath + '"'; var videoFile = VideoFile.Get(context); var outputFolder = OutputFolder.Get(context); var outputContainer = OutputContainer.Get(context); var command = Command.Get(context); var audioFile = AudioFile.Get(context); var debuggingMode = DebuggingMode.Get(context); var startInfo = new ProcessStartInfo(FFMPEGPath); startInfo.WindowStyle = ProcessWindowStyle.Normal; startInfo.WorkingDirectory = FFMPEGDirectory; /* * string inputContainer = videoFile.Substring(videoFile.LastIndexOf('.')); * if (outputContainer == "") * { * outputContainer = inputContainer; * }*/ /* * string fileNameWithoutExtensions = videoFile.Replace(inputContainer, ""); * var fileName = fileNameWithoutExtensions.Substring(fileNameWithoutExtensions.LastIndexOf(@"\")); * fileName = fileName.Replace(@"\", "");*/ var uniqueId = (DateTime.Now.Ticks - new DateTime(2016, 1, 1).Ticks).ToString("x"); startInfo.Arguments = "-i " + '"' + videoFile + '"' + " " + "-i " + '"' + audioFile + '"' + " -c copy -map 0:v -map 1:a -shortest " + '"' + outputFolder + @"\" + uniqueId + "." + outputContainer + '"'; // DateTime.Now.ToString("yyyy-dd-M--HH-mm-ss"); if (debuggingMode) { var processn = new Process(); processn.StartInfo = startInfo; processn.EnableRaisingEvents = true; processn.StartInfo.FileName = "CMD.EXE"; processn.StartInfo.Arguments = "/K " + '"' + @FFMPEGPath + " " + startInfo.Arguments + '"'; processn.Start(); processn.WaitForExit(); } else { var processn = Process.Start(startInfo); processn.EnableRaisingEvents = true; processn.WaitForExit(); } // Outputs return((ctx) => { }); }