Exemplo n.º 1
0
        private void ShowVideoInfo(string path, bool isComplete = false)
        {
            var sb = new StringBuilder();

            try
            {
                using (var mi = new MediaInfo.MediaInfo())
                {
                    mi.Open(path);
                    if (isComplete)
                    {
                        mi.Option(@"Complete", @"1");
                    }
                    else
                    {
                        mi.Option(@"Complete");
                    }
                    sb.AppendLine(mi.Inform());
                }
            }
            catch
            {
                sb.AppendLine(@"读取文件失败,可能是 MediaInfo.dll 加载错误");
            }

            infoTextBox.Invoke(new Action(() => { infoTextBox.Text = sb.ToString(); }));
        }
 public void InfoCodecsTest()
 {
     using (var mi = new AutoSplitVideo.MediaInfo.MediaInfo())
     {
         Debug.WriteLine(@"Info_Codecs:");
         Debug.WriteLine(mi.Option(@"Info_Codecs"));
     }
 }
 public void InfoParametersTest()
 {
     using (var mi = new AutoSplitVideo.MediaInfo.MediaInfo())
     {
         //Information about MediaInfo
         Debug.WriteLine(@"Info_Parameters:");
         Debug.WriteLine(mi.Option(@"Info_Parameters"));
     }
 }
 public void VersionTest()
 {
     using (var mi = new AutoSplitVideo.MediaInfo.MediaInfo())
     {
         var version = mi.Option(@"Info_Version");
         Debug.WriteLine(version);
         if (version.Length == 0)
         {
             Debug.WriteLine(@"MediaInfo.Dll: this version of the DLL is not compatible");
         }
     }
 }
        public void GetMediaInfoTest()
        {
            const string fileName = @"D:\Downloads\test.flv";

            using (var mi = new AutoSplitVideo.MediaInfo.MediaInfo())
            {
                mi.Open(fileName);

                Debug.WriteLine(@"Inform with Complete=false");
                mi.Option(@"Complete");
                Debug.WriteLine(mi.Inform());

                Debug.WriteLine(@"Inform with Complete=true");
                mi.Option(@"Complete", @"1");
                Debug.WriteLine(mi.Inform());

                Debug.WriteLine(@"Custom Inform");
                mi.Option(@"Inform", @"General;File size is %FileSize% bytes");
                Debug.WriteLine(mi.Inform());

                Debug.WriteLine(@"Get with Stream=General and Parameter='FileSize'");
                Debug.WriteLine(mi.Get(StreamKind.General, 0, @"FileSize"));

                Debug.WriteLine(@"Get with Stream=General and Parameter=0");
                Debug.WriteLine(mi.Get(StreamKind.General, 0, 0));

                Debug.WriteLine(@"Count_Get with StreamKind=Stream_Audio");
                Debug.WriteLine(mi.Count_Get(StreamKind.Audio));

                Debug.WriteLine(@"Get with Stream=General and Parameter='AudioCount'");
                Debug.WriteLine(mi.Get(StreamKind.General, 0, @"AudioCount"));

                Debug.WriteLine(@"Get with Stream=Audio and Parameter='StreamCount'");
                Debug.WriteLine(mi.Get(StreamKind.Audio, 0, @"StreamCount"));
            }
        }