Пример #1
0
        private static Instance PrepareInstance(string filePath, int outputCapacity, FFOptions ffOptions)
        {
            FFProbeHelper.RootExceptionCheck();
            FFProbeHelper.VerifyFFProbeExists(ffOptions);
            var arguments = $"-loglevel error -print_format json -show_format -sexagesimal -show_streams \"{filePath}\"";
            var instance  = new Instance(GlobalFFOptions.GetFFProbeBinaryPath(), arguments)
            {
                DataBufferCapacity = outputCapacity
            };

            return(instance);
        }
Пример #2
0
        private Instance PrepareInstance(FFOptions ffMpegOptions,
                                         out CancellationTokenSource cancellationTokenSource)
        {
            FFMpegHelper.RootExceptionCheck();
            FFMpegHelper.VerifyFFMpegExists(ffMpegOptions);
            var startInfo = new ProcessStartInfo
            {
                FileName  = GlobalFFOptions.GetFFMpegBinaryPath(ffMpegOptions),
                Arguments = _ffMpegArguments.Text,
                StandardOutputEncoding = ffMpegOptions.Encoding,
                StandardErrorEncoding  = ffMpegOptions.Encoding,
            };
            var instance = new Instance(startInfo);

            cancellationTokenSource = new CancellationTokenSource();

            if (_onOutput != null || _onTimeProgress != null || (_onPercentageProgress != null && _totalTimespan != null))
            {
                instance.DataReceived += OutputData;
            }

            return(instance);
        }