Esempio n. 1
0
        /// <summary>
        /// 去水印事件
        /// </summary>
        private async void ExecuteDelogoCommand()
        {
            if (isDelogo)
            {
                eventAggregator.GetEvent <MessageEvent>().Publish(DictionaryResource.GetString("TipWaitTaskFinished"));
                return;
            }

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

            if (LogoWidth == -1)
            {
                eventAggregator.GetEvent <MessageEvent>().Publish(DictionaryResource.GetString("TipInputRightLogoWidth"));
                return;
            }
            if (LogoHeight == -1)
            {
                eventAggregator.GetEvent <MessageEvent>().Publish(DictionaryResource.GetString("TipInputRightLogoHeight"));
                return;
            }
            if (LogoX == -1)
            {
                eventAggregator.GetEvent <MessageEvent>().Publish(DictionaryResource.GetString("TipInputRightLogoX"));
                return;
            }
            if (LogoY == -1)
            {
                eventAggregator.GetEvent <MessageEvent>().Publish(DictionaryResource.GetString("TipInputRightLogoY"));
                return;
            }

            // 新文件名
            string newFileName = VideoPath.Insert(VideoPath.Length - 4, "_delogo");

            Status = string.Empty;

            await Task.Run(() =>
            {
                // 执行去水印程序
                isDelogo = true;
                FFmpegHelper.Delogo(VideoPath, newFileName, LogoX, LogoY, LogoWidth, LogoHeight, new Action <string>((output) =>
                {
                    Status += output + "\n";
                }));
                isDelogo = false;
            });
        }