Ejemplo n.º 1
0
        /// <summary>
        /// 提取视频事件
        /// </summary>
        private async void ExecuteExtractVideoCommand()
        {
            if (isExtracting)
            {
                eventAggregator.GetEvent <MessageEvent>().Publish(DictionaryResource.GetString("TipWaitTaskFinished"));
                return;
            }

            if (VideoPath == "")
            {
                eventAggregator.GetEvent <MessageEvent>().Publish(DictionaryResource.GetString("TipNoSeletedVideo"));
                return;
            }

            // 视频文件名
            string videoFileName = VideoPath.Remove(VideoPath.Length - 4, 4) + "_onlyVideo.mp4";

            Status = string.Empty;

            await Task.Run(() =>
            {
                // 执行提取视频程序
                isExtracting = true;
                FFmpegHelper.ExtractVideo(VideoPath, videoFileName, new Action <string>((output) =>
                {
                    Status += output + "\n";
                }));
                isExtracting = false;
            });
        }