public static string GetMediaQuality(this MediaInfo.MediaInfoWrapper mediaInfoWrapper) { if (mediaInfoWrapper is null) { throw new ArgumentNullException(nameof(mediaInfoWrapper)); } string mediaQuality = string.Empty; VideoStream videoStream = mediaInfoWrapper.BestVideoStream; if (videoStream.Width >= 3840 || videoStream.Height >= 2160) { mediaQuality += "4K"; } else if (videoStream.Width >= 1280 || videoStream.Height >= 720) { mediaQuality += "HD"; } else { mediaQuality += "SD"; } mediaQuality += mediaInfoWrapper.IsHdr ? " HDR" : ""; mediaQuality += mediaInfoWrapper.Is3D ? " 3D" : ""; mediaQuality += mediaInfoWrapper.IsDvd ? " DVD" : ""; mediaQuality += mediaInfoWrapper.IsBluRay ? " BluRay" : ""; return(mediaQuality); }
public void GetInfo(string videoPath) { MediaInfo.MediaInfoWrapper mediaInfo = new MediaInfo.MediaInfoWrapper(videoPath); Video v = new Video { Path = videoPath, Bitrate = mediaInfo.VideoRate, Duration = mediaInfo.Duration, Framerate = mediaInfo.Framerate, Height = mediaInfo.Height, Width = mediaInfo.Width, Size = mediaInfo.Size, Format = mediaInfo.VideoCodec, Aspectratio = mediaInfo.AspectRatio, AudioChannels = mediaInfo.AudioChannelsFriendly, AudioCodec = mediaInfo.AudioCodec, AudioRate = mediaInfo.AudioRate, AudioSampleRate = mediaInfo.AudioSampleRate }; videos.Add(v); }