示例#1
0
        public string GetInfo(ExtractorInfoType type)
        {
            var process = FFprobe.GetProcess();

            switch (type)
            {
            case ExtractorInfoType.AudioCodec:
                process.StartInfo.Arguments = GetStartArgument(FFprobeParameter.AudioCodec);
                break;

            case ExtractorInfoType.VideoCodec:
                process.StartInfo.Arguments = GetStartArgument(FFprobeParameter.VideoCodec);
                break;

            case ExtractorInfoType.Bitrate:
                process.StartInfo.Arguments = GetStartArgument(FFprobeParameter.VideoBitrate);
                break;

            case ExtractorInfoType.Dimension:
                process.StartInfo.Arguments = GetStartArgument(FFprobeParameter.VideoDimension);
                break;

            case ExtractorInfoType.Duration:
                process.StartInfo.Arguments = GetStartArgument(FFprobeParameter.VideoDuration);
                break;

            case ExtractorInfoType.Framerate:
                process.StartInfo.Arguments = GetStartArgument(FFprobeParameter.VideoFramerate);
                break;
            }
            var data = GetProcessOutput(process);

            return(data);
        }
示例#2
0
        public string GetAudioCodec()
        {
            var process = FFprobe.GetProcess();

            process.StartInfo.Arguments = GetStartArgument(FFprobeParameter.AudioCodec);
            var codec = GetProcessOutput(process);

            return(codec);
        }
示例#3
0
        public string GetVideoDimension()
        {
            var ffprobeProcess = FFprobe.GetProcess();

            ffprobeProcess.StartInfo.Arguments = GetStartArgument(FFprobeParameter.VideoDimension);
            var dimension = GetProcessOutput(ffprobeProcess);

            return(dimension);
        }
示例#4
0
        public TimeSpan GetVideoDuration()
        {
            var process = FFprobe.GetProcess();

            process.StartInfo.Arguments = GetStartArgument(FFprobeParameter.VideoDuration);
            var output   = GetProcessOutput(process);
            var duration = ConvertToTimeSpan(output);

            return(duration);
        }
示例#5
0
        public double GetVideoFramerate()
        {
            var process = FFprobe.GetProcess();

            process.StartInfo.Arguments = GetStartArgument(FFprobeParameter.VideoFramerate);
            var output    = GetProcessOutput(process);
            var framerate = ConvertToDouble(output);

            return(framerate);
        }
示例#6
0
        public MetadataInfo GetVideoMetaDataInfo()
        {
            var process = FFprobe.GetProcess();

            process.StartInfo.Arguments = GetStartArgument(FFprobeParameter.VideoMetaData);
            var output     = GetProcessOutput(process);
            var audioCodec = GetAudioCodec();
            var metaData   = GetMetaDataFromOutput(output, audioCodec);

            return(metaData);
        }
示例#7
0
        public async Task <string> GetAudioCodecAsync()
        {
            var ffprobeProcess = FFprobe.GetProcess();

            ffprobeProcess.StartInfo.Arguments = GetStartArgument(FFprobeParameter.AudioCodec);
            var codec = await Task.Run(async() =>
            {
                var output = await GetProcessOutputAsync(ffprobeProcess);
                return(output);
            });

            return(codec);
        }
示例#8
0
        public async Task <string> GetVideoDimensionAsync()
        {
            var ffprobeProcess = FFprobe.GetProcess();

            ffprobeProcess.StartInfo.Arguments = GetStartArgument(FFprobeParameter.VideoDimension);
            var dimension = await Task.Run(async() =>
            {
                var output = await GetProcessOutputAsync(ffprobeProcess);
                return(output);
            });

            return(dimension);
        }
示例#9
0
        public async Task <TimeSpan> GetVideoDurationAsync()
        {
            var ffprobeProcess = FFprobe.GetProcess();

            ffprobeProcess.StartInfo.Arguments = GetStartArgument(FFprobeParameter.VideoDuration);
            var duration = await Task.Run(async() =>
            {
                var output = await GetProcessOutputAsync(ffprobeProcess);
                var data   = ConvertToTimeSpan(output);
                return(data);
            });

            return(duration);
        }
示例#10
0
        public async Task <double> GetVideoFramerateAsync()
        {
            var ffprobeProcess = FFprobe.GetProcess();

            ffprobeProcess.StartInfo.Arguments = GetStartArgument(FFprobeParameter.VideoFramerate);
            var framerate = await Task.Run(async() =>
            {
                var output = await GetProcessOutputAsync(ffprobeProcess);
                var data   = ConvertToDouble(output);
                return(data);
            });

            return(framerate);
        }
示例#11
0
        public async Task <MetadataInfo> GetVideoMetaDataInfoAsync()
        {
            var process = FFprobe.GetProcess();

            process.StartInfo.Arguments = GetStartArgument(FFprobeParameter.VideoMetaData);
            var dataTask = Task.Run(async() =>
            {
                var output = await GetProcessOutputAsync(process);
                return(output);
            });
            var audioCodecTask = GetAudioCodecAsync();
            var data           = await Task.WhenAll(dataTask, audioCodecTask);

            var metaData = GetMetaDataFromOutput(data[0], data[1]);

            return(metaData);
        }