Beispiel #1
0
        private static VideoInfo TryConvert(FF.FFProbe ffprobe)
        {
            var info = new VideoInfo()
            {
                Duration = ConvertDuration(ffprobe.format?.duration),
                Video    = ffprobe.streams?.Where(IsVideo).Select(GetXmlVideo).ToArray(),
                Audio    = ffprobe.streams?.Where(IsAudio).Select(GetXmlAudio).ToArray(),
                Subtitle = ffprobe.streams?.Where(IsSubtile).Select(GetXmlSubtitle).ToArray(),
            };

            info.DurationSpecified = info.Duration > 0;

            if (info.Video?.Length == 0)
            {
                info.Video = null;
            }

            if (info.Audio?.Length == 0)
            {
                info.Audio = null;
            }

            if (info.Subtitle?.Length == 0)
            {
                info.Subtitle = null;
            }

            return(info);
        }
Beispiel #2
0
        public static VideoInfo Convert(FF.FFProbe ffprobe, string originalLanguage)
        {
            _originalLanguage = originalLanguage;

            try
            {
                var info = TryConvert(ffprobe);

                return(info);
            }
            finally
            {
                _originalLanguage = null;
            }
        }