示例#1
0
        private Size GetMediaSizeWithVlc(string path)
        {
            using (var vlc = new Vlc(VlcSettings.VlcOptions))
            {
                using (var media = vlc.CreateMediaFromPath(path))
                {
                    media.Parse();
                    var tracks = media.GetTracks();
                    var video  = tracks.FirstOrDefault(mt => mt.Type == TrackType.Video) as VideoTrack;

                    return(video == null ? Size.Empty : new Size(video.Width, video.Height));
                }
            }
        }
示例#2
0
        private bool HasVideoStream(string path, out Size size)
        {
            using (var vlc = new Vlc(VlcSettings.VlcOptions))
            {
                using (var media = vlc.CreateMediaFromPath(path))
                {
                    media.Parse();
                    var tracks = media.GetTracks();
                    var video  = tracks.FirstOrDefault(mt => mt.Type == TrackType.Video) as VideoTrack;

                    size = video == null ? Size.Empty : new Size(video.Width, video.Height);

                    return(video != null);
                }
            }
        }