private async Task ProcessList() { //Check all is ok before continuing if (!CheckIfProcessCanBeInvoked()) { return; } var animPath = _skeletonGameProvider.GameConfig.DmdPath; if (animPath.Contains(".")) { _dmdPath = new Uri(Path.Combine(_skeletonGameProvider.GameFolder, animPath), UriKind.RelativeOrAbsolute); } else { _dmdPath = new Uri(animPath); } var voicePath = _skeletonGameProvider.GameConfig.VoiceDir; _voiceDir = new Uri(Path.Combine(_skeletonGameProvider.GameFolder, _skeletonGameProvider.GameConfig.SoundPath, voicePath), UriKind.RelativeOrAbsolute); VideoHelper.AudioExportFolder = _voiceDir.AbsolutePath; VideoHelper.VideoExportFolder = _dmdPath.AbsolutePath; //Get the assets path and create a temp directory to store the conversions var assetsPath = _dmdPath.AbsolutePath.Replace(@"/dmd", string.Empty); if (!Directory.Exists(assetsPath + @"\temp")) { Directory.CreateDirectory(assetsPath + @"\temp"); } //Show a window await Task.Run(() => { foreach (var video in VideoProcessItems) { try { //Temp video file name var tempOutputFile = Path.Combine(assetsPath, "temp", video.ExportName + ".mp4"); var ffmpeg = _ffmpeg + "\\x86\\ffmpeg.exe"; //Is user wanting to resize to match the display resolution? string resolution = null; if (video.ResizeToDmdSize) { resolution = $"{ _skeletonGameProvider.GameConfig.DmdDotsWidth}x{ _skeletonGameProvider.GameConfig.DmdDotsHeight}"; } //Is user just exporting the audio? If so we don't need to reencode the file // Is not precise! //if (video.ExportAudio && !video.ExportVideo) //{ // tempOutputFile = Path.Combine(assetsPath, "temp", video.ExportName + "." + video.SelectedAudioType.ToString()); // VideoHelper.ConvertAudioClip(ffmpeg, video.File, tempOutputFile, video.Video.StartFrame, video.Video.Frames - 1, video.Video.FrameRate); //} //Process this clip to the temporary directory VideoHelper.ConvertVideoClip(ffmpeg, video.File, tempOutputFile, video.Video.StartTime, video.Video.EndTime, video.Video.FrameRate, resolution, video.SelectedSpeed.ToString()); //Split the temporary file and put into asset folders if (video.SplitVideoAndAudio) { VideoHelper.SplitAudioAndVideo(ffmpeg, tempOutputFile, video.ExportName, video.ExportVideo, video.ExportAudio, video.SelectedAudioType.ToString()); } } //Any errors show to the user catch (Exception ex) { System.Windows.MessageBox.Show(ex.Message); return; } } }); //Remove the busy window VideoProcessItems.Clear(); }