Exemplo n.º 1
0
        private async void ButtonCutVideo_Click(object sender, RoutedEventArgs e)
        {
            this.InputFile = SelectFile(this.InputFile);
            if (string.IsNullOrWhiteSpace(this.InputFile))
            {
                return;
            }

            string outputFile = Path.Combine(Path.GetDirectoryName(InputFile), Path.GetFileNameWithoutExtension(InputFile) + "_Cut" + Path.GetExtension(InputFile));

            using (var ffmpeg = new FFmpeg(FFmpegFileName))
            {
                ffmpeg.OnProgress  += OnProgressEvent;
                ffmpeg.OnCompleted += OnCompletedEvent;
                ffmpeg.OnData      += (s, args) => { OutputText(args.Data); };

                OutputText("***Start cut video");

                await Task.Run(() => ffmpeg.CutMedia(this.InputFile, outputFile, TimeSpan.FromMilliseconds((7 * 60 + 28) * 1000 + 600), TimeSpan.FromMilliseconds((7 * 60 + 54) * 1000 + 200)));

                OutputText("***Ready cut video");
            }
        }