private void OnVideoProcessAdded(TrimVideo trimVideo) { VideoProcessItems.Add(new SceneProcessItemViewModel(_eventAggregator) { File = trimVideo.File, Video = trimVideo, Overwrite = false, }); }
/// <summary> /// Does the process list have valid names and not empty strings. /// </summary> /// <returns></returns> private bool DoesProcessListHaveValidNamesAndNotEmptyStrings() { bool result = true; if (VideoProcessItems.Any(x => string.IsNullOrWhiteSpace(x.ExportName))) { result = false; } return(result); }
private void OnVideoProcessAdded(TrimVideo trimVideo) { VideoProcessItems.Add(new VideoProcessViewModelItem(_eventAggregator) { File = trimVideo.File, StartTime = trimVideo.Start, EndTime = trimVideo.End, Duration = trimVideo.End - trimVideo.Start, Overwrite = false, SystemName = trimVideo.SystemName, }); trimVideo = null; }
private async Task ProcessList() { await Task.Run(() => { var ff = _settings.HypermintSettings.Ffmpeg; foreach (var video in VideoProcessItems) { try { VideoHelper.TrimVideoRange(ff, video.File, @"C:\Temp\OutputProcess.mp4", video.StartTime, video.EndTime); } catch (Exception ex) { } } }); VideoProcessItems.Clear(); }
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(); }