private void RunSecondPass()
        {
            var inputFile = new InputFileOptions();
            inputFile.FilePath = Path.GetFullPath(SourceFilePath);

            var outputFile = new OutputFileOptions();

            if (ShouldDeinterlaceVideo)
                outputFile.Add(new DeinterlaceVideoOption());

            if (_VideoWidth.IsSet && _VideoWidth.Value != 0)
                GeckonPresets.ApplyHighQualitySecondPassPreset(outputFile, VideoBitrate, AudioBitrate, VideoWidth, VideoHeight);
            else
                GeckonPresets.ApplyHighQualitySecondPassPreset(outputFile, VideoBitrate, AudioBitrate);

            outputFile.FilePath = Path.GetFullPath(DestinationFilePath);

            outputFile.Add(new ThreadsOption(ThreadsOption.AUTOMATICALLY_SELECT_NUMBER_OF_THREADS));

            using (var wrapper = new FFmpegWrapper())
            {
                wrapper.FFmpegExecutablePath = Path.GetFullPath(FFmpegFilePath);

                wrapper.AddInputFileOptions(inputFile);
                wrapper.OutputFileOptions = outputFile;

                wrapper.WorkingDirectory = TemporaryDirectoryPath;

                wrapper.ProgressDataChanged += SecondPassProgressDataChanged;

                wrapper.UnparsedOutputOccurred += (sender, args) => _FFmpegOutput.AppendLine(args.EventObject);
                wrapper.WarningOccurred += (sender, args) => _FFmpegOutput.AppendLine(args.EventObject.Warning);
                wrapper.ErrorOccurred += (sender, args) => _FFmpegOutput.AppendLine(args.EventObject.ToString());

                wrapper.Execute();

                FFmpegArguments += "\n" + wrapper.FFmpegArguments;

                wrapper.ProgressDataChanged -= SecondPassProgressDataChanged;
            }
        }
Esempio n. 2
0
        private void CutFrame()
        {
            var inputFile = new InputFileOptions();
            inputFile.FilePath = Path.GetFullPath(SourceFilePath);

            var outputFile = new OutputFileOptions();

            if (_Width.IsSet && _Width.Value != 0)
                GeckonPresets.ApplyCutVideoFramePreset(inputFile, outputFile, TimeSpan.Parse(_VideoPosition.Value), Width, Height);
            else
                GeckonPresets.ApplyCutVideoFramePreset(inputFile, outputFile, TimeSpan.Parse(_VideoPosition.Value));

            outputFile.FilePath = Path.GetFullPath(DestinationFilePath);

            using (var wrapper = new FFmpegWrapper())
            {
                wrapper.FFmpegExecutablePath = Path.GetFullPath(FFmpegFilePath);

                wrapper.AddInputFileOptions(inputFile);
                wrapper.OutputFileOptions = outputFile;

                wrapper.ProgressDataChanged += ProgressDataChanged;

                wrapper.RawOutputOccurred += (sender, e) => Console.WriteLine(e.EventObject);

                wrapper.Execute();

                wrapper.ProgressDataChanged -= ProgressDataChanged;
            }
        }