Exemplo n.º 1
0
        private static MediaInfoContainer DoWorkHandler(string fileName)
        {
            MediaInfoContainer mi = new MediaInfoContainer();

            mi.GetMediaInfo(fileName);
            return(mi);
        }
Exemplo n.º 2
0
 private static MediaInfoContainer DoWorkHandler(string fileName)
 {
     return(MediaInfoContainer.GetMediaInfo(fileName));
 }
Exemplo n.º 3
0
        /// <summary>
        /// Determines Media Type of the input file
        /// </summary>
        /// <param name="pathToFile">Path to input file</param>
        /// <returns><see cref="InputType"/></returns>
        public InputType CheckFileType(string pathToFile)
        {
            MediaInfoContainer mi;

            try
            {
                mi = MediaInfoContainer.GetMediaInfo(pathToFile);
            }
            catch (TimeoutException ex)
            {
                Log.Error(ex);
                mi = new MediaInfoContainer();
            }

            var containerFormat = mi.General.Format;

            Log.Info($"General.FileName:                {mi.General.CompleteName}");
            Log.Info($"General.FileExtension:           {mi.General.FileExtension}");
            Log.Info($"General.Format:                  {mi.General.Format}");
            Log.Info($"General.FormatExtensions:        {mi.General.FormatExtensions}");
            Log.Info($"General.InternetMediaType:       {mi.General.InternetMediaType}");
            Log.Info($"General.EncodedApplication:      {mi.General.EncodedApplication}");
            Log.Info($"General.EncodedApplicationUrl:   {mi.General.EncodedApplicationUrl}");
            Log.Info($"General.EncodedLibrary:          {mi.General.EncodedLibrary}");
            Log.Info($"General.EncodedLibraryDate:      {mi.General.EncodedLibraryDate}");
            Log.Info($"General.EncodedLibraryName:      {mi.General.EncodedLibraryName}");
            Log.Info($"General.EncodedLibrarySettings:  {mi.General.EncodedLibrarySettings}");
            Log.Info($"General.EncodedLibraryVersion:   {mi.General.EncodedLibraryVersion}");
            Log.Info(string.Empty);

            foreach (var item in mi.Video)
            {
                Log.Info($"Video.ID:                        {item.ID:0}");
                Log.Info($"Video.StreamKindID:              {item.StreamKindID:0}");
                Log.Info($"Video.StreamKindPos:             {item.StreamKindPos:0}");
                Log.Info($"Video.CodecID:                   {item.CodecID}");
                Log.Info($"Video.CodecIDInfo:               {item.CodecIDInfo}");
                Log.Info($"Video.CodecIDURL:                {item.CodecIDUrl}");
                Log.Info($"Video.CodecIDDescription:        {item.CodecIDDescription}");
                Log.Info($"Video.InternetMediaType:         {item.InternetMediaType}");
                Log.Info($"Video.Format:                    {item.Format}");
                Log.Info($"Video.FormatProfile:             {item.FormatProfile}");
                Log.Info($"Video.FormatInfo:                {item.FormatInfo}");
                Log.Info($"Video.FormatVersion:             {item.FormatVersion}");
                Log.Info($"Video.MultiViewBaseProfile:      {item.MultiViewBaseProfile}");
                Log.Info($"Video.MultiViewCount:            {item.MultiViewCount}");
                Log.Info($"Video.DisplayAspectRatio:        {item.DisplayAspectRatio}");
                Log.Info($"Video.PixelAspectRatio:          {item.PixelAspectRatio}");
                Log.Info($"Video.BitrateMode:               {item.BitRateMode}");
                Log.Info($"Video.Bitrate:                   {item.BitRate:0}");
                Log.Info($"Video.BitrateNom:                {item.BitRateNom:0}");
                Log.Info($"Video.BitrateMin:                {item.BitRateMin:0}");
                Log.Info($"Video.BitrateMax:                {item.BitRateMax:0}");
                Log.Info($"Video.BitDepth:                  {item.BitDepth:0}");
                Log.Info($"Video.FrameRate:                 {item.FrameRate:0.###}".ToString(CultureInfo.InvariantCulture));
                Log.Info($"Video.FrameRateMax:              {item.FrameRateMax:0.###}".ToString(CultureInfo.InvariantCulture));
                Log.Info($"Video.FrameRateMin:              {item.FrameRateMin:0.###}".ToString(CultureInfo.InvariantCulture));
                Log.Info($"Video.FrameRateNom:              {item.FrameRateNom:0.###}".ToString(CultureInfo.InvariantCulture));
                Log.Info($"Video.FrameRateMode:             {item.FrameRateMode}");
                Log.Info($"Video.Height:                    {item.Height:0}");
                Log.Info($"Video.Width:                     {item.Width:0}");
                Log.Info($"Video.VideoSize:                 {item.VideoSize}");
                Log.Info($"Video.ScanType:                  {item.ScanType}");
                Log.Info($"Video.ScanOrder:                 {item.ScanOrder}");
                Log.Info($"Video.EncodedApplication:        {item.EncodedApplication}");
                Log.Info($"Video.EncodedApplicationUrl:     {item.EncodedApplicationUrl}");
                Log.Info($"Video.EncodedLibrary:            {item.EncodedLibrary}");
                Log.Info($"Video.EncodedLibraryDate:        {item.EncodedLibraryDate}");
                Log.Info($"Video.EncodedLibraryName:        {item.EncodedLibraryName}");
                Log.Info($"Video.EncodedLibrarySettings:    {item.EncodedLibrarySettings}");
                Log.Info($"Video.EncodedLibraryVersion:     {item.EncodedLibraryVersion}");
            }
            Log.Info(string.Empty);

            foreach (var item in mi.Audio)
            {
                Log.Info($"Audio.ID:                        {item.ID:0}");
                Log.Info($"Audio.StreamKindID:              {item.StreamKindID:0}");
                Log.Info($"Audio.StreamKindPos:             {item.StreamKindPos:0}");
                Log.Info($"Audio.CodecID:                   {item.CodecID}");
                Log.Info($"Audio.CodecIDInfo:               {item.CodecIDInfo}");
                Log.Info($"Audio.CodecIDURL:                {item.CodecIDUrl}");
                Log.Info($"Audio.CodecIDDescription:        {item.CodecIDDescription}");
                Log.Info($"Audio.Format:                    {item.Format}");
                Log.Info($"Audio.FormatProfile:             {item.FormatProfile}");
                Log.Info($"Audio.FormatInfo:                {item.FormatInfo}");
                Log.Info($"Audio.FormatVersion:             {item.FormatVersion}");
                Log.Info($"Audio.Channels:                  {item.Channels:0}");
                Log.Info($"Audio.ChannelsString:            {item.ChannelsString}");
                Log.Info($"Audio.BitrateMode:               {item.BitRateMode}");
                Log.Info($"Audio.Bitrate:                   {item.BitRate:0}");
                Log.Info($"Audio.BitrateNom:                {item.BitRateNom:0}");
                Log.Info($"Audio.BitrateMin:                {item.BitRateMin:0}");
                Log.Info($"Audio.BitrateMax:                {item.BitRateMax:0}");
                Log.Info($"Audio.BitDepth:                  {item.BitDepth:0}");
                Log.Info($"Audio.SamplingRate:              {item.SamplingRate:0}");
                Log.Info($"Audio.EncodedLibrary:            {item.EncodedLibrary}");
                Log.Info($"Audio.EncodedLibraryDate:        {item.EncodedLibraryDate}");
                Log.Info($"Audio.EncodedLibraryName:        {item.EncodedLibraryName}");
                Log.Info($"Audio.EncodedLibrarySettings:    {item.EncodedLibrarySettings}");
                Log.Info($"Audio.EncodedLibraryVersion:     {item.EncodedLibraryVersion}");
            }
            Log.Info(string.Empty);

            switch (containerFormat)
            {
            case "Matroska":
                return(InputType.InputMatroska);

            case "AVI":
                return(InputType.InputAvi);

            case "MPEG-4":
                return(InputType.InputMp4);

            case "BDAV":
            case "MPEG-TS":
                return(InputType.InputTs);

            case "Windows Media":
                return(InputType.InputWm);

            case "Flash Video":
                return(InputType.InputFlash);

            case "MPEG-PS":
                return(InputType.InputMpegps);

            case "WebM":
                return(InputType.InputWebM);

            case "OGG":
                return(InputType.InputOgg);
            }

            return(Path.GetExtension(pathToFile) == ".avs" ? InputType.InputAviSynth : InputType.InputUndefined);
        }