当前位置: 首页>>代码示例>>C#>>正文


C# MediaInfo.Close方法代码示例

本文整理汇总了C#中MediaInfoLib.MediaInfo.Close方法的典型用法代码示例。如果您正苦于以下问题:C# MediaInfo.Close方法的具体用法?C# MediaInfo.Close怎么用?C# MediaInfo.Close使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MediaInfoLib.MediaInfo的用法示例。


在下文中一共展示了MediaInfo.Close方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetVideoFileTakenDate

        public static DateTime? GetVideoFileTakenDate(string filePath)
        {
            MediaInfo mediaInfo = null;
            try
            {
                mediaInfo = new MediaInfo();
                mediaInfo.Open(filePath);

                DateTime? result = null;
                string recordedDate = mediaInfo.Get(StreamKind.General, 0, "Recorded_Date");
                if (!string.IsNullOrWhiteSpace(recordedDate))
                {
                    result = DateTime.Parse(recordedDate, CultureInfo.InvariantCulture, DateTimeStyles.AssumeLocal);
                }

                if (result == null)
                {
                    recordedDate = mediaInfo.Get(StreamKind.General, 0, "Encoded_Date");
                    if (string.IsNullOrWhiteSpace(recordedDate))
                    {
                        recordedDate = mediaInfo.Get(StreamKind.General, 0, "Tagged_Date");
                    }
                    if (!string.IsNullOrWhiteSpace(recordedDate))
                    {
                        var dateTimeStyles = DateTimeStyles.AssumeUniversal;
                        // Canon records local time as UTC
                        var canonCameraIdentifier = mediaInfo.Get(StreamKind.General, 0, "CodecID/String");
                        if (canonCameraIdentifier.Contains("/CAEP"))
                        {
                            dateTimeStyles = DateTimeStyles.AssumeLocal;
                        }

                        result = DateTime.ParseExact(recordedDate, "\"UTC\" yyyy-MM-dd HH:mm:ss",
                            CultureInfo.InvariantCulture, dateTimeStyles);
                    }
                }

                if (result == null)
                {
                    recordedDate = mediaInfo.Get(StreamKind.General, 0, "Mastered_Date");
                    if (!string.IsNullOrWhiteSpace(recordedDate))
                    {
                        result = DateTime.ParseExact(recordedDate, "ddd MMM dd HH:mm:ss yyyy",
                            CultureInfo.InvariantCulture, DateTimeStyles.AssumeLocal);
                    }
                }
                return result;
            }
            catch (Exception)
            {
            }
            finally
            {
                if (mediaInfo != null)
                {
                    mediaInfo.Close();
                }
            }
            return null;
        }
开发者ID:anton-iermolenko,项目名称:Photo-library-toolkit,代码行数:60,代码来源:VideoInfo.cs

示例2: MediaViewModel

        public MediaViewModel(string Name = "",
            string ArtistName = "",
            string AlbumName = "",
            Uri Path = null,
            String Length = "00:00:00")
        {
            Dictionary<String, String> tmp = new Dictionary<string, string>();
            if (Path != null)
            {
                try
                {
                    MediaInfo lol = new MediaInfo();
                    if (lol.Open(Uri.UnescapeDataString(Path.AbsolutePath)) == 1)
                    {
                        foreach (string entry in lol.Inform().Split('\n'))
                        {
                            var tokens = entry.Split(':');
                            if (tokens.Length == 2)
                                tmp[tokens[0].Trim()] = tokens[1].Trim();
                        }
                        lol.Close();
                    }
                }
                catch (Exception e)
                {
                    MessageBox.Show("MediaInfo: "+ e.Message);
                }
            }

            Song = new Media(tmp.ContainsKey("Track name") ? tmp["Track name"] : "",
                            tmp.ContainsKey("Performer") ? tmp["Performer"] : "",
                            tmp.ContainsKey("Album") ? tmp["Album"] : "",
                            Path, tmp.ContainsKey("Duration") ? getLength(tmp["Duration"]) : "");
        }
开发者ID:Vyko,项目名称:MyWmp,代码行数:34,代码来源:MediaViewModel.cs

示例3: FileInput

            public FileInput(string filename)
            {
                this.filename = filename;
                MediaInfo MI = new MediaInfo();
                if (MI.Open(this.GetFileName()) > 0)
                {

                    string s = MI.Option("Info_Parameters");

                    int width = int.Parse(MI.Get(StreamKind.Video, 0, "Width"));
                    int height = int.Parse(MI.Get(StreamKind.Video, 0, "Height"));
                    decimal aspect = (decimal)width / (decimal)height;
                    bool resize = false;
                    if (width > 1280)
                    {
                        width = 1280;
                        height = (int)(width / aspect);
                        resize = true;
                    }
                    if (height > 720)
                    {
                        height = 720;
                        width = (int)(height * aspect);
                        resize = true;
                    }
                    if (resize)
                    {
                        if (width % 2 > 0)
                            width -= 1;
                        if (height % 2 > 0)
                            height -= 1;
                        this._size = " -s " + width + "x" + height;
                    }
                    Log.WriteLine("resize=" + resize + ",size=" + width + "x" + height);


                    int videobitrate = int.Parse(MI.Get(StreamKind.Video, 0, "BitRate"));
                    if (videobitrate > 7 * 1024 * 1024 || resize)
                    {
                        this._parameter = " libx264 -coder 0 -flags -loop -cmp +chroma -partitions -parti8x8-parti4x4-partp8x8-partb8x8 -me_method dia -subq 0 -me_range 16 -g 250 -keyint_min 25 -sc_threshold 0 -i_qfactor 0.71 -b_strategy 0 -qcomp 0.6 -qmin 10 -qmax 51 -qdiff 4 -bf 0 -refs 1 -directpred 1 -trellis 0 -flags2 -bpyramid-mixed_refs-wpred-dct8x8+fastpskip-mbtree -wpredp 0 -b 4096k ";
                    }
                    else
                    {
                        this._parameter = " copy";
                    }
                    this._parameter = " -vcodec " + this._parameter;
                    //Log.WriteLine("media info supported :" + s);

                    MI.Close();
                }


                if (this.GetFileName().ToLower().EndsWith(".mp4") || this.GetFileName().ToLower().EndsWith(".mkv"))
                {
                    this._parameter += " -vbsf h264_mp4toannexb ";
                }
                this._parameter += " -acodec libfaac -ac 2 -ab 192k ";
            }
开发者ID:jorgeantwan18,项目名称:rokumedia,代码行数:58,代码来源:FileHttpLiveStreaming.cs

示例4: Main

        public static void Main()
        {
            MediaInfo MI = new MediaInfo();

            //change the files accordingly, tested with .avi, .mpg, .mpeg - these should be enough
            MI.Open("1.flv"); 

            string display = "";
            display += "FileName: " + MI.Get(0, 0, "FileName") + "\n";
            display += "FileExtension: " + MI.Get(0, 0, "FileExtension") + "\n";
            display += "Title: " + MI.Get(0, 0, "Title") + "\n";
            display += "Subtitle: " + MI.Get(0, 0, "Title/More") + "\n";
            display += "Tags: " + MI.Get(0, 0, "WM/Category") + "\n";
            display += "Comments: " + MI.Get(0, 0, "Comment") + "\n";

            string sizeInKBStr = MI.Get(0, 0, "FileSize/String").Substring(0, MI.Get(0, 0, "FileSize/String").LastIndexOf(" ")).Replace(" ", "");
            double sizeInKB = Double.Parse(sizeInKBStr);
            double sizeInMB = (double)(sizeInKB / 1024);
            string sizeInMBStr = String.Format("{0:0.00}", sizeInMB); 
            display += "Size: " + sizeInMBStr + " MB" + "\n";
            display += "Date created: " + MI.Get(0, 0, "File_Created_Date").Substring(MI.Get(0, 0, "File_Created_Date").IndexOf(" ") + 1, MI.Get(0, 0, "File_Created_Date").LastIndexOf(".")-4) + "\n";
            display += "Date modified: " + MI.Get(0, 0, "File_Modified_Date").Substring(MI.Get(0, 0, "File_Modified_Date").IndexOf(" ") + 1, MI.Get(0, 0, "File_Modified_Date").LastIndexOf(".")-4) + "\n";

            display += "\nVIDEO\n";
            display += "Length: " + MI.Get(0, 0, "Duration/String3").Substring(0, MI.Get(0, 0, "Duration/String3").LastIndexOf(".")) + "\n";
            display += "Frame width: " + MI.Get(StreamKind.Video, 0, "Width/String") + "\n";
            display += "Frame height: " + MI.Get(StreamKind.Video, 0, "Height/String") + "\n";
            if (MI.Get(StreamKind.Video, 0, "BitRate/String") != "")
                display += "Data rate: " + MI.Get(StreamKind.Video, 0, "BitRate/String").Substring(0, MI.Get(StreamKind.Video, 0, "BitRate/String").LastIndexOf(" ")).Replace(" ", "") + " kbps" + "\n";
            else
                display += "Data rate:\n";
            string frameRateOriStr = MI.Get(StreamKind.Video, 0, "FrameRate/String").Substring(0, MI.Get(StreamKind.Video, 0, "FrameRate/String").LastIndexOf(" ")).Replace(" ", "");
            double frameRate = Double.Parse(frameRateOriStr);
            string frameRateStr = String.Format("{0:0}", frameRate);
            display += "Frame rate: " + frameRateStr + " fps" + "\n";

            display += "\nAUDIO\n";
            string bitrateOriStr = MI.Get(StreamKind.Audio, 0, "BitRate/String").Substring(0, MI.Get(StreamKind.Audio, 0, "BitRate/String").LastIndexOf(" ")).Replace(" ", "");
            double bitrateRate = Double.Parse(bitrateOriStr);
            string bitrateRateStr = String.Format("{0:0}", bitrateRate);
            display += "Bitrate: " + bitrateRateStr + " kbps" + "\n";
            display += "Channels: " + MI.Get(StreamKind.Audio, 0, "Channel(s)/String") + "\n";
            string audioSampleRateOriStr = MI.Get(StreamKind.Audio, 0, "SamplingRate/String").Substring(0, MI.Get(StreamKind.Audio, 0, "SamplingRate/String").LastIndexOf(" ")).Replace(" ", "");
            double audioSampleRate = Double.Parse(audioSampleRateOriStr);
            string audioSampleRateStr = String.Format("{0:0}", audioSampleRate);
            display += "Audio sample rate: " + audioSampleRateStr + " kHz" + "\n";

            display += "\nMEDIA\n";
            display += "Artist: " + MI.Get(0, 0, "Performer") + "\n";
            display += "Year: " + MI.Get(0, 0, "Recorded_Date") + "\n";
            display += "Genre: " + MI.Get(0, 0, "Genre") + "\n";            

            MI.Close();

            Console.WriteLine(display);

        }
开发者ID:angad,项目名称:PeopleBAWX,代码行数:57,代码来源:Program.cs

示例5: Musiikki

 public Musiikki(string nimi, string filePath)
 {
     FilePath = filePath;
     MediaInfo MI = new MediaInfo();
     MI.Open(FilePath);
     Nimi = MI.Get(StreamKind.General, 0, "FileName");
     Pituus = MI.Get(StreamKind.General, 0, "Duration/String");
     SoundEncoding = MI.Get(StreamKind.Audio, 0, "Language/String") + "," + MI.Get(StreamKind.Audio, 0, "SamplingRate/String") + "," + MI.Get(StreamKind.Audio, 0, "Channel(s)/String") + "," + MI.Get(StreamKind.General, 0, "Audio_Format_List");
     TiedostonKoko = MI.Get(StreamKind.General, 0, "FileSize/String");
     MI.Close();
 }
开发者ID:Jeeqqq,项目名称:IIO13200-HTYO-Shareyourmovies,代码行数:11,代码来源:Musiikki.cs

示例6: Elokuva

 public Elokuva(string nimi, string filePath)
 {
     Watched = false;
     FilePath = filePath;
     MediaInfo MI = new MediaInfo();
     MI.Open(FilePath);
     nimi = MI.Get(StreamKind.General, 0, "FileName");
     Nimi = TrimNimi(nimi);
     Pituus = MI.Get(StreamKind.General, 0, "Duration/String");
     VideoEncoding = MI.Get(StreamKind.General, 0, "Format");
     SoundEncoding = MI.Get(StreamKind.Audio, 0, "Language/String") + "," + MI.Get(StreamKind.Audio, 0, "SamplingRate/String") + "," + MI.Get(StreamKind.Audio, 0, "Channel(s)/String") + "," + MI.Get(StreamKind.General, 0, "Audio_Format_List");
     TiedostonKoko = MI.Get(StreamKind.General, 0, "FileSize/String");
     Fps = MI.Get(StreamKind.Video, 0, "FrameRate/String");
     Resolution = MI.Get(StreamKind.Video, 0, "Width") + "x" + MI.Get(StreamKind.Video, 0, "Height");
     MI.Close();
     Movie movie = Search.getMovieInfoFromDb(Nimi);
       //  movie.Elokuva = this;
     DbTiedot=movie;
 }
开发者ID:Jeeqqq,项目名称:IIO13200-HTYO-Shareyourmovies,代码行数:19,代码来源:Elokuvat.cs

示例7: GetRunTime

        public virtual Int32 GetRunTime(string filename)
        {
            var mediaInfo = new MediaInfo();

            try
            {
                logger.Trace("Getting media info from {0}", filename);

                mediaInfo.Option("ParseSpeed", "0.2");
                int open = mediaInfo.Open(filename);

                if (open != 0)
                {
                    int runTime;
                    Int32.TryParse(mediaInfo.Get(StreamKind.General, 0, "PlayTime"), out runTime);

                    mediaInfo.Close();
                    return runTime / 1000; //Convert to seconds
                }
            }
            catch (Exception ex)
            {
                logger.ErrorException("Unable to parse media info from file: " + filename, ex);
                mediaInfo.Close();
            }

            return 0;
        }
开发者ID:realpatriot,项目名称:NzbDrone,代码行数:28,代码来源:MediaInfoProvider.cs

示例8: GetMediaInfoString


//.........这里部分代码省略.........
                //全局
                string container = MI.Get(StreamKind.General, 0, "Format");
                string bitRate = MI.Get(StreamKind.General, 0, "BitRate/String");
                string duration = MI.Get(StreamKind.General, 0, "Duration/String1");
                string fileSize = MI.Get(StreamKind.General, 0, "FileSize/String");
                //视频
                string v_id = MI.Get(StreamKind.Video, 0, "ID");
                string v_format = MI.Get(StreamKind.Video, 0, "Format");
                string v_bitRate = MI.Get(StreamKind.Video, 0, "BitRate/String");
                string v_size = MI.Get(StreamKind.Video, 0, "StreamSize/String");
                string v_width = MI.Get(StreamKind.Video, 0, "Width");
                string v_height = MI.Get(StreamKind.Video, 0, "Height");
                string v_displayAspectRatio = MI.Get(StreamKind.Video, 0, "DisplayAspectRatio/String");
                string v_displayAspectRatio2 = MI.Get(StreamKind.Video, 0, "DisplayAspectRatio");
                string v_frameRate = MI.Get(StreamKind.Video, 0, "FrameRate/String");
                string v_colorSpace = MI.Get(StreamKind.Video, 0, "ColorSpace");
                string v_chromaSubsampling = MI.Get(StreamKind.Video, 0, "ChromaSubsampling");
                string v_bitDepth = MI.Get(StreamKind.Video, 0, "BitDepth/String");
                string v_scanType = MI.Get(StreamKind.Video, 0, "ScanType/String");
                string v_pixelAspectRatio = MI.Get(StreamKind.Video, 0, "PixelAspectRatio");
                string v_encodedLibrary = MI.Get(StreamKind.Video, 0, "Encoded_Library/String");
                string v_encodingSettings = MI.Get(StreamKind.Video, 0, "Encoded_Library_Settings");
                string v_encodedTime = MI.Get(StreamKind.Video, 0, "Encoded_Date");
                string v_codecProfile = MI.Get(StreamKind.Video, 0, "Codec_Profile");
                string v_frameCount = MI.Get(StreamKind.Video, 0, "FrameCount");

                //音频
                string a_id = MI.Get(StreamKind.Audio, 0, "ID");
                string a_format = MI.Get(StreamKind.Audio, 0, "Format");
                string a_bitRate = MI.Get(StreamKind.Audio, 0, "BitRate/String");
                string a_samplingRate = MI.Get(StreamKind.Audio, 0, "SamplingRate/String");
                string a_channel = MI.Get(StreamKind.Audio, 0, "Channel(s)");
                string a_size = MI.Get(StreamKind.Audio, 0, "StreamSize/String");

                string audioInfo = MI.Get(StreamKind.Audio, 0, "Inform")
                    + MI.Get(StreamKind.Audio, 1, "Inform")
                    + MI.Get(StreamKind.Audio, 2, "Inform")
                    + MI.Get(StreamKind.Audio, 3, "Inform");
                string videoInfo = MI.Get(StreamKind.Video, 0, "Inform");

                info = info.Append(Path.GetFileName(VideoName) + "\r\n");
                if (!string.IsNullOrEmpty(container))
                    info.Append("容器:" + container + "\r\n");
                if (!string.IsNullOrEmpty(bitRate))
                    info.Append("总码率:" + bitRate + "\r\n");
                if (!string.IsNullOrEmpty(fileSize))
                    info.Append("大小:" + fileSize + "\r\n");
                if (!string.IsNullOrEmpty(duration))
                    info.Append("时长:" + duration + "\r\n");

                if (!string.IsNullOrEmpty(v_format))
                    info.Append("\r\n" + "视频(" + v_id + "):" + v_format + "\r\n");
                if (!string.IsNullOrEmpty(v_codecProfile))
                    info.Append("Profile:" + v_codecProfile + "\r\n");
                if (!string.IsNullOrEmpty(v_bitRate))
                    info.Append("码率:" + v_bitRate + "\r\n");
                if (!string.IsNullOrEmpty(v_size))
                    info.Append("文件大小:" + v_size + "\r\n");
                if (!string.IsNullOrEmpty(v_width) && !string.IsNullOrEmpty(v_height))
                    info.Append("分辨率:" + v_width + "x" + v_height + "\r\n");
                if (!string.IsNullOrEmpty(v_displayAspectRatio) && !string.IsNullOrEmpty(v_displayAspectRatio2))
                    info.Append("画面比例:" + v_displayAspectRatio + "(" + v_displayAspectRatio2 + ")" + "\r\n");
                if (!string.IsNullOrEmpty(v_pixelAspectRatio))
                    info.Append("像素宽高比:" + v_pixelAspectRatio + "\r\n");
                if (!string.IsNullOrEmpty(v_frameRate))
                    info.Append("帧率:" + v_frameRate + "\r\n");
                if (!string.IsNullOrEmpty(v_colorSpace))
                    info.Append("色彩空间:" + v_colorSpace + "\r\n");
                if (!string.IsNullOrEmpty(v_chromaSubsampling))
                    info.Append("色度抽样:" + v_chromaSubsampling + "\r\n");
                if (!string.IsNullOrEmpty(v_bitDepth))
                    info.Append("位深度:" + v_bitDepth + "\r\n");
                if (!string.IsNullOrEmpty(v_scanType))
                    info.Append("扫描方式:" + v_scanType + "\r\n");
                if (!string.IsNullOrEmpty(v_encodedTime))
                    info.Append("编码时间:" + v_encodedTime + "\r\n");
                if (!string.IsNullOrEmpty(v_frameCount))
                    info.Append("总帧数:" + v_frameCount + "\r\n");
                if (!string.IsNullOrEmpty(v_encodedLibrary))
                    info.Append("编码库:" + v_encodedLibrary + "\r\n");
                if (!string.IsNullOrEmpty(v_encodingSettings))
                    info.Append("编码设置:" + v_encodingSettings + "\r\n");

                if (!string.IsNullOrEmpty(a_format))
                    info.Append("\r\n" + "音频(" + a_id + "):" + a_format + "\r\n");
                if (!string.IsNullOrEmpty(a_size))
                    info.Append("大小:" + a_size + "\r\n");
                if (!string.IsNullOrEmpty(a_bitRate))
                    info.Append("码率:" + a_bitRate + "\r\n");
                if (!string.IsNullOrEmpty(a_samplingRate))
                    info.Append("采样率:" + a_samplingRate + "\r\n");
                if (!string.IsNullOrEmpty(a_channel))
                    info.Append("声道数:" + a_channel + "\r\n");
                info.Append("\r\n====详细信息====\r\n" + videoInfo + "\r\n" + audioInfo + "\r\n");
                MI.Close();
            }
            else
                info.Append("文件不存在、非有效文件或者文件夹 无视频信息");
            return info.ToString();
        }
开发者ID:celeron533,项目名称:marukotoolbox,代码行数:101,代码来源:MainForm.cs

示例9: GetDuration

 private Int32 GetDuration(string location)
 {
     MediaInfoLib.MediaInfo mediaInfo = new MediaInfoLib.MediaInfo();
     mediaInfo.Option("ParseSpeed", "0.3");
     int i = mediaInfo.Open(location);
     int runTime = 0;
     if (i != 0)
     {
         Int32.TryParse(mediaInfo.Get(StreamKind.General, 0, "PlayTime"), out runTime);
     }
     mediaInfo.Close();
     return runTime;
 }
开发者ID:rickbassham,项目名称:videobrowser,代码行数:13,代码来源:MediaInfoProvider.cs

示例10: MediaInfo

        public string MediaInfo(string VideoName)
        {
            string info = "无视频信息";
            if (File.Exists(VideoName))
            {
                MediaInfo MI = new MediaInfo();
                MI.Open(VideoName);
                //全局
                string container = MI.Get(StreamKind.General, 0, "Format");
                string bitrate = MI.Get(StreamKind.General, 0, "BitRate/String");
                string duration = MI.Get(StreamKind.General, 0, "Duration/String1");
                string fileSize = MI.Get(StreamKind.General, 0, "FileSize/String");
                //视频
                string vid = MI.Get(StreamKind.Video, 0, "ID");
                string video = MI.Get(StreamKind.Video, 0, "Format");
                string vBitRate = MI.Get(StreamKind.Video, 0, "BitRate/String");
                string vSize = MI.Get(StreamKind.Video, 0, "StreamSize/String");
                string width = MI.Get(StreamKind.Video, 0, "Width");
                string height = MI.Get(StreamKind.Video, 0, "Height");
                string risplayAspectRatio = MI.Get(StreamKind.Video, 0, "DisplayAspectRatio/String");
                string risplayAspectRatio2 = MI.Get(StreamKind.Video, 0, "DisplayAspectRatio");
                string frameRate = MI.Get(StreamKind.Video, 0, "FrameRate/String");
                string bitDepth = MI.Get(StreamKind.Video, 0, "BitDepth/String");
                string pixelAspectRatio = MI.Get(StreamKind.Video, 0, "PixelAspectRatio");
                string encodedLibrary = MI.Get(StreamKind.Video, 0, "Encoded_Library");
                string encodeTime = MI.Get(StreamKind.Video, 0, "Encoded_Date");
                string codecProfile = MI.Get(StreamKind.Video, 0, "Codec_Profile");
                string frameCount = MI.Get(StreamKind.Video, 0, "FrameCount");

                //音频
                string aid = MI.Get(StreamKind.Audio, 0, "ID");
                string audio = MI.Get(StreamKind.Audio, 0, "Format");
                string aBitRate = MI.Get(StreamKind.Audio, 0, "BitRate/String");
                string samplingRate = MI.Get(StreamKind.Audio, 0, "SamplingRate/String");
                string channel = MI.Get(StreamKind.Audio, 0, "Channel(s)");
                string aSize = MI.Get(StreamKind.Audio, 0, "StreamSize/String");

                string audioInfo = MI.Get(StreamKind.Audio, 0, "Inform") + MI.Get(StreamKind.Audio, 1, "Inform") + MI.Get(StreamKind.Audio, 2, "Inform") + MI.Get(StreamKind.Audio, 3, "Inform");
                string videoInfo = MI.Get(StreamKind.Video, 0, "Inform");

                info = Path.GetFileName(VideoName) + "\r\n" +
                    "容器:" + container + "\r\n" +
                    "总码率:" + bitrate + "\r\n" +
                    "大小:" + fileSize + "\r\n" +
                    "时长:" + duration + "\r\n" +
                    "\r\n" +
                    "视频(" + vid + "):" + video + "\r\n" +
                    "码率:" + vBitRate + "\r\n" +
                    "大小:" + vSize + "\r\n" +
                    "分辨率:" + width + "x" + height + "\r\n" +
                    "宽高比:" + risplayAspectRatio + "(" + risplayAspectRatio2 + ")" + "\r\n" +
                    "帧率:" + frameRate + "\r\n" +
                    "位深度:" + bitDepth + "\r\n" +
                    "像素宽高比:" + pixelAspectRatio + "\r\n" +
                    "编码库:" + encodedLibrary + "\r\n" +
                    "Profile:" + codecProfile + "\r\n" +
                    "编码时间:" + encodeTime + "\r\n" +
                    "总帧数:" + frameCount + "\r\n" +

                    "\r\n" +
                    "音频(" + aid + "):" + audio + "\r\n" +
                    "大小:" + aSize + "\r\n" +
                    "码率:" + aBitRate + "\r\n" +
                    "采样率:" + samplingRate + "\r\n" +
                    "声道数:" + channel + "\r\n" +
                    "\r\n====详细信息====\r\n" +
                    videoInfo + "\r\n" +
                    audioInfo + "\r\n"
                    ;
                MI.Close();
            }
            return info;
        }
开发者ID:wljcom,项目名称:marukotoolbox,代码行数:73,代码来源:MainForm.cs

示例11: ReplaceChapters


//.........这里部分代码省略.........
                }
                //End Check

                if (str == "")
                {
                    continue;
                }

                if (str.Contains("Progress"))
                {
                    Progress = Convert.ToInt32(parseProgress(str)) / 2;
                }
                else if (str.Contains("Error"))
                {
                    MessageBox.Show(null, str, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }

            //Add the new

            var info2 = new FileInfo(workDir + "\\" + newFileName);
            var MI = new MediaInfo();

            MI.Open(info2.FullName);

            string cpath;

            if (ChapterMode == ChapterModes.ChapterSet)
            {
                WriteLog("Creating chapterfile: " + workDir + "\\chapters.xml");
                cpath = CreateChapterFile(CustomChapterSet, workDir + "\\chapters.xml");
            }
            else if (ChapterMode == ChapterModes.File)
            {
                WriteLog("Using pre-set chapterfile: " + CustomChapterFile);
                cpath = CustomChapterFile;
            }
            else
            {
                WriteLog("Creating chapterfile: " + workDir + "\\chapters.xml");
                cpath = CreateChapterFile(CreateChapterSet(GetMovieRuntime(info.FullName), ChapterInterval), workDir + "\\chapters.xml");
            }

            string newFileName2 = CustomOutputName.Replace("%O", Path.GetFileNameWithoutExtension(info2.FullName)) + ".mkv";

            newpath = q + workDir + "\\" + newFileName2 + q;
            oldpath = q + info2.FullName + q;

            args = "-o " + newpath + " --chapters " + q + cpath + q + " --compression -1:none " + oldpath;

            prcinfo.Arguments = args;

            prc.StartInfo = prcinfo;
            prc.Start();

            while ((str = prc.StandardOutput.ReadLine()) != null)
            {
                //Check for Cancellation

                if (chapterizeWorker.CancellationPending)
                {
                    MI.Close();

                    if (!prc.WaitForExit(500))
                    {
                        prc.Kill();
                        Thread.Sleep(1000);
                    }

                    if (ChapterMode != ChapterModes.File)
                    {
                        File.Delete(cpath);
                    }
                    return workDir + "\\" + newFileName;
                }
                //End Check

                if (str != "")
                {
                    if (str.Contains("Progress"))
                    {
                        Progress = 50 + Convert.ToInt32(parseProgress(str)) / 2;
                    }
                    else if (str.Contains("Error"))
                    {
                        MessageBox.Show(null, str, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
            }

            if (ChapterMode != ChapterModes.File)
            {
                File.Delete(cpath);
            }

            File.Delete(workDir + "\\" + newFileName);
            File.Move(workDir + "\\" + newFileName2, workDir + "\\" + newFileName);

            return new FileInfo(workDir + "\\" + newFileName);
        }
开发者ID:Jim-1960,项目名称:mkv-chapterizer,代码行数:101,代码来源:TheChapterizer.cs

示例12: CheckInputFile

        private void CheckInputFile(Media mf)
        {
            using (FFMpegWrapper ff = new FFMpegWrapper(mf.FullPath))
            {
                inputFileStreams = ff.GetStreamInfo();
            }

            MediaInfo mi = new MediaInfo();
            try
            {
                mi.Open(mf.FullPath);
                mi.Option("Complete");
                string miOutput = mi.Inform();

                Regex format_lxf = new Regex("Format\\s*:\\s*LXF");
                if (format_lxf.Match(miOutput).Success)
                {
                    string[] miOutputLines = miOutput.Split('\n');
                    Regex vitc = new Regex("ATC_VITC");
                    Regex re = new Regex("Time code of first frame\\s*:[\\s]\\d{2}:\\d{2}:\\d{2}:\\d{2}");
                    for (int i = 0; i < miOutputLines.Length; i++)
                    {
                        if (vitc.Match(miOutputLines[i]).Success && i >= 1)
                        {
                            Match m_tcs = re.Match(miOutputLines[i - 1]);
                            if (m_tcs.Success)
                            {
                                Regex reg_tc = new Regex("\\d{2}:\\d{2}:\\d{2}:\\d{2}");
                                Match m_tc = reg_tc.Match(m_tcs.Value);
                                if (m_tc.Success)
                                {
                                    DestMedia.TCStart = reg_tc.Match(m_tc.Value).Value.SMPTETimecodeToTimeSpan();
                                    if (DestMedia.TCPlay == TimeSpan.Zero)
                                        DestMedia.TCPlay = DestMedia.TCStart;
                                    break;
                                }
                            }
                        }
                    }
                }

                Regex format_mxf = new Regex(@"Format\s*:\s*MXF");
                if (format_mxf.Match(miOutput).Success)
                {
                    string[] miOutputLines = miOutput.Split('\n');
                    Regex mxf_tc = new Regex(@"MXF TC");
                    Regex re = new Regex(@"Time code of first frame\s*:[\s]\d{2}:\d{2}:\d{2}:\d{2}");
                    for (int i = 0; i < miOutputLines.Length; i++)
                    {
                        Match mxf_match = mxf_tc.Match(miOutputLines[i]);
                        if (mxf_match.Success && i < miOutputLines.Length - 1)
                        {
                            Regex reg_tc = new Regex(@"\d{2}:\d{2}:\d{2}:\d{2}");
                            Match m_tc = re.Match(miOutputLines[i + 1]);
                            if (m_tc.Success)
                            {
                                DestMedia.TCStart = reg_tc.Match(m_tc.Value).Value.SMPTETimecodeToTimeSpan();
                                if (DestMedia.TCPlay == TimeSpan.Zero)
                                    DestMedia.TCPlay = DestMedia.TCStart;
                                break;
                            }
                        }
                    }
                }
            }
            finally
            {
                mi.Close();
            }
        }
开发者ID:jstarpl,项目名称:PlayoutAutomation,代码行数:70,代码来源:ConvertOperation.cs

示例13: ReadDirectory

        private void ReadDirectory()
        {
            // if a folder then read all media files
            // append all the durations and save in Duration
            if (Directory.Exists(Location))
            {
                // get largest file
                FileCollection = GetFilesToProcess(Location);
                List<FileInfo> listFileInfo = new List<FileInfo>();
                foreach (string fp in FileCollection)
                {
                    listFileInfo.Add(new FileInfo(fp));
                }

                // Subtitles, Format: DVD Video using VTS_01_0.IFO
                string[] ifo = Directory.GetFiles(Location, "VTS_01_0.IFO", SearchOption.AllDirectories);
                if (ifo.Length == 1) // CHECK IF A DVD
                {
                    this.MediaTypeChoice = MediaType.MediaDisc;
                    MediaInfoLib.MediaInfo mi = new MediaInfoLib.MediaInfo();
                    this.DiscType = TDMakerLib.SourceType.DVD;

                    mi.Open(ifo[0]);

                    // most prolly this will be: DVD Video
                    this.Overall.Format = mi.Get(StreamKind.General, 0, "Format");

                    int subCount = 0;
                    int.TryParse(mi.Get(StreamKind.Text, 0, "StreamCount"), out subCount);

                    if (subCount > 0)
                    {
                        List<string> langs = new List<string>();
                        for (int i = 0; i < subCount; i++)
                        {
                            string lang = mi.Get(StreamKind.Text, i, "Language/String");
                            if (!string.IsNullOrEmpty(lang))
                            {
                                // System.Windows.Forms.MessageBox.Show(lang);
                                if (!langs.Contains(lang))
                                    langs.Add(lang);
                            }
                        }
                        StringBuilder sbLangs = new StringBuilder();
                        for (int i = 0; i < langs.Count; i++)
                        {
                            sbLangs.Append(langs[i]);
                            if (i < langs.Count - 1)
                                sbLangs.Append(", ");
                        }

                        this.Overall.Subtitles = sbLangs.ToString();
                    }

                    // close ifo file
                    mi.Close();

                    // AFTER IDENTIFIED THE MEDIA TYPE IS A DVD
                    listFileInfo.RemoveAll(x => x.Length < 1000000000);
                }

                // Set Media Type
                bool allAudio = Adapter.MediaIsAudio(FileCollection);
                if (allAudio)
                {
                    this.MediaTypeChoice = MediaType.MusicAudioAlbum;
                }

                if (FileCollection.Count > 0)
                {
                    foreach (FileInfo fi in listFileInfo)
                    {
                        this.AddMedia(new MediaFile(fi.FullName, this.Source));
                    }

                    this.Overall = new MediaFile(FileSystemHelper.GetLargestFilePathFromDir(Location), this.Source);

                    // Set Overall File Name
                    this.Overall.FileName = Path.GetFileName(Location);
                    if (Overall.FileName.ToUpper().Equals("VIDEO_TS"))
                        Overall.FileName = Path.GetFileName(Path.GetDirectoryName(Location));
                    if (string.IsNullOrEmpty(Title))
                        this.Title = this.Overall.FileName;
                }

                // DVD Video
                // Combined Duration and File Size
                if (MediaTypeChoice == MediaType.MediaDisc)
                {
                    if (listFileInfo.Count > 0)
                    {
                        long dura = 0;
                        double size = 0;
                        foreach (FileInfo fiVob in listFileInfo)
                        {
                            MediaInfoLib.MediaInfo mi = new MediaInfoLib.MediaInfo();
                            mi.Open(fiVob.FullName);
                            string temp = mi.Get(0, 0, "Duration");
                            if (!string.IsNullOrEmpty(temp))
                            {
//.........这里部分代码省略.........
开发者ID:a253560600,项目名称:tdmaker,代码行数:101,代码来源:MediaInfo2.cs

示例14: Form1_Load

        private void Form1_Load(object sender, System.EventArgs e)
        {
            //Test if version of DLL is compatible : 3rd argument is "version of DLL tested;Your application name;Your application version"
            String ToDisplay;
            MediaInfo MI = new MediaInfo();

            ToDisplay = MI.Option("Info_Version", "0.7.0.0;MediaInfoDLL_Example_CS;0.7.0.0");
            if (ToDisplay.Length == 0)
            {
                richTextBox1.Text = "MediaInfo.Dll: this version of the DLL is not compatible";
                return;
            }

            //Information about MediaInfo
            ToDisplay += "\r\n\r\nInfo_Parameters\r\n";
            ToDisplay += MI.Option("Info_Parameters");

            ToDisplay += "\r\n\r\nInfo_Capacities\r\n";
            ToDisplay += MI.Option("Info_Capacities");

            ToDisplay += "\r\n\r\nInfo_Codecs\r\n";
            ToDisplay += MI.Option("Info_Codecs");

            //An example of how to use the library
            ToDisplay += "\r\n\r\nOpen\r\n";
            MI.Open("Example.ogg");

            ToDisplay += "\r\n\r\nInform with Complete=false\r\n";
            MI.Option("Complete");
            ToDisplay += MI.Inform();

            ToDisplay += "\r\n\r\nInform with Complete=true\r\n";
            MI.Option("Complete", "1");
            ToDisplay += MI.Inform();

            ToDisplay += "\r\n\r\nCustom Inform\r\n";
            MI.Option("Inform", "General;File size is %FileSize% bytes");
            ToDisplay += MI.Inform();

            ToDisplay += "\r\n\r\nGet with Stream=General and Parameter='FileSize'\r\n";
            ToDisplay += MI.Get(0, 0, "FileSize");

            ToDisplay += "\r\n\r\nGet with Stream=General and Parameter=46\r\n";
            ToDisplay += MI.Get(0, 0, 46);

            ToDisplay += "\r\n\r\nCount_Get with StreamKind=Stream_Audio\r\n";
            ToDisplay += MI.Count_Get(StreamKind.Audio);

            ToDisplay += "\r\n\r\nGet with Stream=General and Parameter='AudioCount'\r\n";
            ToDisplay += MI.Get(StreamKind.General, 0, "AudioCount");

            ToDisplay += "\r\n\r\nGet with Stream=Audio and Parameter='StreamCount'\r\n";
            ToDisplay += MI.Get(StreamKind.Audio, 0, "StreamCount");

            ToDisplay += "\r\n\r\nClose\r\n";
            MI.Close();

            //Example with a stream
            //ToDisplay+="\r\n"+ExampleWithStream()+"\r\n";

            Crc16Ccitt A=new Crc16Ccitt(InitialCrcValue.Zeros);
            byte[] B = { 0x84, 0x00, 0x00, 0x00, 0x6B, 0x00, 0x00, 0x00, 0x67, 0x1F, 0x20, 0x00, 0x00, 0x62, 0x0C, 0x9B, 0x35, 0x35, 0x38, 0x3B, 0x34, 0x31, 0x36, 0x20, 0x56, 0x9B, 0x38, 0x31, 0x3B, 0x33, 0x32, 0x20, 0x5F, 0x90, 0x6F, 0x90, 0x20, 0x41, 0x90, 0x7E, 0x9B, 0x31, 0x3B, 0x30, 0x30, 0x30, 0x30, 0x20, 0x63, 0x9B, 0x30, 0x20, 0x58, 0x1C, 0x40, 0x40, 0x1C, 0x46, 0x40, 0x90, 0x20, 0x40, 0x90, 0x50, 0xC9, 0xB3, 0xC7, 0x89, 0x20, 0x1D, 0x61, 0x1B, 0x7E, 0xC0, 0xA4, 0xE9, 0xF3, 0xC1, 0xF3, 0x8A, 0x24, 0x72, 0x21, 0x29, 0x88, 0x1C, 0x4F, 0x41, 0x89, 0xE1, 0xAD, 0xB7, 0xB3, 0x8A, 0x21, 0x29, 0x89, 0x20, 0x8A, 0x21, 0x44, 0x89, 0xA4, 0xF3, 0xBF, 0xF9, 0xCD, 0xC3, 0xC8, 0x8A, 0x21, 0x29 };
            ushort C=A.ComputeChecksum(B);

            //Displaying the text
            richTextBox1.Text = ToDisplay;
        }
开发者ID:beppec56,项目名称:MediaInfoLib-git_svn,代码行数:67,代码来源:HowToUse_Dll.cs

示例15: GetMediaInfo

        public virtual MediaInfoModel GetMediaInfo(string filename)
        {
            if (!_diskProvider.FileExists(filename))
                throw new FileNotFoundException("Media file does not exist: " + filename);

            var mediaInfo = new MediaInfo();

            try
            {
                logger.Trace("Getting media info from {0}", filename);

                mediaInfo.Option("ParseSpeed", "0.2");
                int open = mediaInfo.Open(filename);

                if (open != 0)
                {
                    int width;
                    int height;
                    int videoBitRate;
                    int audioBitRate;
                    int runTime;
                    int streamCount;
                    int audioChannels;

                    string subtitles = mediaInfo.Get(StreamKind.General, 0, "Text_Language_List");
                    string scanType = mediaInfo.Get(StreamKind.Video, 0, "ScanType");
                    Int32.TryParse(mediaInfo.Get(StreamKind.Video, 0, "Width"), out width);
                    Int32.TryParse(mediaInfo.Get(StreamKind.Video, 0, "Height"), out height);
                    Int32.TryParse(mediaInfo.Get(StreamKind.Video, 0, "BitRate"), out videoBitRate);

                    string aBitRate = mediaInfo.Get(StreamKind.Audio, 0, "BitRate");
                    int ABindex = aBitRate.IndexOf(" /");
                    if (ABindex > 0)
                        aBitRate = aBitRate.Remove(ABindex);

                    Int32.TryParse(aBitRate, out audioBitRate);
                    Int32.TryParse(mediaInfo.Get(StreamKind.General, 0, "PlayTime"), out runTime);
                    Int32.TryParse(mediaInfo.Get(StreamKind.Audio, 0, "StreamCount"), out streamCount);

                    string audioChannelsStr = mediaInfo.Get(StreamKind.Audio, 0, "Channel(s)");
                    int ACindex = audioChannelsStr.IndexOf(" /");
                    if (ACindex > 0)
                        audioChannelsStr = audioChannelsStr.Remove(ACindex);

                    string audioLanguages = mediaInfo.Get(StreamKind.General, 0, "Audio_Language_List");
                    decimal videoFrameRate = Decimal.Parse(mediaInfo.Get(StreamKind.Video, 0, "FrameRate"));
                    string audioProfile = mediaInfo.Get(StreamKind.Audio, 0, "Format_Profile");

                    int APindex = audioProfile.IndexOf(" /");
                    if (APindex > 0)
                        audioProfile = audioProfile.Remove(APindex);

                    Int32.TryParse(audioChannelsStr, out audioChannels);
                    var mediaInfoModel = new MediaInfoModel
                                                {
                                                    VideoCodec = mediaInfo.Get(StreamKind.Video, 0, "Codec/String"),
                                                    VideoBitrate = videoBitRate,
                                                    Height = height,
                                                    Width = width,
                                                    AudioFormat = mediaInfo.Get(StreamKind.Audio, 0, "Format"),
                                                    AudioBitrate = audioBitRate,
                                                    RunTime = (runTime / 1000), //InSeconds
                                                    AudioStreamCount = streamCount,
                                                    AudioChannels = audioChannels,
                                                    AudioProfile = audioProfile.Trim(),
                                                    VideoFps = videoFrameRate,
                                                    AudioLanguages = audioLanguages,
                                                    Subtitles = subtitles,
                                                    ScanType = scanType
                                                };

                    mediaInfo.Close();
                    return mediaInfoModel;
                }
            }
            catch (Exception ex)
            {
                logger.ErrorException("Unable to parse media info from file: " + filename, ex);
                mediaInfo.Close();
            }

            return null;
        }
开发者ID:realpatriot,项目名称:NzbDrone,代码行数:83,代码来源:MediaInfoProvider.cs


注:本文中的MediaInfoLib.MediaInfo.Close方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。