private void GetInfo() { try { tbxInfo.ToolTip = null; //Чтоб не мешался if (infomode == InfoMode.MediaInfo) { //http://mediainfo.sourceforge.net/en/Support/SDK/More_Info //краткая инфа MediaInfoWrapper media = new MediaInfoWrapper(); media.Open(infilepath); media.Option("Complete", ""); media.Option("Language", " Config_Text_ColumnSize;" + Settings.MI_ColumnSize); tbxInfo.Text = media.Option("Info_Version", "") + "\r\n\r\n"; tbxInfo.Text += media.Inform(); media.Close(); } else if (infomode == InfoMode.MediaInfoFull) { //полная инфа MediaInfoWrapper media = new MediaInfoWrapper(); media.Open(infilepath); media.Option("Complete", "1"); media.Option("Language", " Config_Text_ColumnSize;" + Settings.MI_ColumnSize); tbxInfo.Text = media.Option("Info_Version", "") + "\r\n\r\n"; tbxInfo.Text += media.Inform(); media.Close(); } else if (infomode == InfoMode.MP4BoxInfo) { encoderProcess = new Process(); ProcessStartInfo info = new ProcessStartInfo(); info.FileName = Calculate.StartupPath + "\\apps\\MP4Box\\MP4Box.exe"; info.WorkingDirectory = Path.GetDirectoryName(info.FileName); info.UseShellExecute = false; info.RedirectStandardOutput = true; info.RedirectStandardError = false; info.CreateNoWindow = true; info.Arguments = "-info \"" + infilepath + "\""; encoderProcess.StartInfo = info; encoderProcess.Start(); tbxInfo.Text = encoderProcess.StandardOutput.ReadToEnd(); } else if (infomode == InfoMode.MKVInfo) { encoderProcess = new Process(); ProcessStartInfo info = new ProcessStartInfo(); info.FileName = Calculate.StartupPath + "\\apps\\MKVtoolnix\\mkvinfo.exe"; info.WorkingDirectory = Path.GetDirectoryName(info.FileName); info.UseShellExecute = false; info.RedirectStandardOutput = true; info.RedirectStandardError = false; info.CreateNoWindow = true; string charset = ""; string _charset = Settings.MKVToolnix_Charset; try { if (_charset == "") { info.StandardOutputEncoding = System.Text.Encoding.UTF8; charset = " --output-charset UTF-8"; } else if (_charset.ToLower() == "auto") { info.StandardOutputEncoding = System.Text.Encoding.Default; charset = " --output-charset " + System.Text.Encoding.Default.HeaderName; } else { int page = 0; if (int.TryParse(_charset, out page)) info.StandardOutputEncoding = System.Text.Encoding.GetEncoding(page); else info.StandardOutputEncoding = System.Text.Encoding.GetEncoding(_charset); charset = " --output-charset " + _charset; } } catch (Exception) { } info.Arguments = "\"" + infilepath + "\"" + charset; encoderProcess.StartInfo = info; encoderProcess.Start(); tbxInfo.Text = encoderProcess.StandardOutput.ReadToEnd().Replace("\r\r\n", "\r\n"); } else if (infomode == InfoMode.FFmpegInfo) { ff = new FFInfo(); ff.Open(infilepath); if (ff.info.Length > 0) { string sortedinfo = ""; string[] lines = ff.info.ToString().Split(new string[] { Environment.NewLine }, StringSplitOptions.None); foreach (string line in lines) { if (!line.StartsWith(" configuration:") && !line.StartsWith(" lib") && !line.StartsWith(" built on") && !line.StartsWith("At least one output") && !line.StartsWith("This program is not") && line != "") sortedinfo += line + Environment.NewLine; } tbxInfo.Text = sortedinfo + "\r\n\r\n"; } else tbxInfo.Clear(); //Размер файла string size_s = ""; double size = (new FileInfo(infilepath).Length) / 1048576.0; if (size > 1024) size_s = (size / 1024.0).ToString("0.##", new System.Globalization.CultureInfo("en-US")) + " Gb\r\n"; else size_s = size.ToString("0.##", new System.Globalization.CultureInfo("en-US")) + " Mb\r\n"; //Общая инфа tbxInfo.Text += "General:\r\n"; tbxInfo.Text += "Total streams : " + ff.StreamsCount() + " (Video: " + ff.VideoStreams().Count + ", Audio: " + ff.AudioStreams().Count + ")\r\n"; tbxInfo.Text += "Total duration : " + ff.Timeline() + " (" + ff.Duration().TotalSeconds.ToString("0.##", new System.Globalization.CultureInfo("en-US")) + " seconds)\r\n"; tbxInfo.Text += "Total bitrate : " + ff.TotalBitrate() + " Kbps\r\n"; tbxInfo.Text += "Total size : " + size_s; //Видео треки int v_count = ff.VideoStreams().Count, v_num = 1; foreach (int num in ff.VideoStreams()) { tbxInfo.Text += "\r\nVideo stream #" + v_num + ":\r\n"; tbxInfo.Text += "ID : 0." + num + Environment.NewLine; tbxInfo.Text += "Codec : " + ff.StreamCodec(num) + Environment.NewLine; tbxInfo.Text += "Width : " + ff.StreamW(num) + " pixels\r\n"; tbxInfo.Text += "Height : " + ff.StreamH(num) + " pixels\r\n"; tbxInfo.Text += "Aspect (DAR) : " + ff.StreamDAR(num) + Environment.NewLine; tbxInfo.Text += "Aspect (PAR) : " + ff.StreamPAR(num) + Environment.NewLine; tbxInfo.Text += "Colorspace : " + ff.StreamColor(num) + Environment.NewLine; tbxInfo.Text += "Framerate : " + ff.StreamFramerate(num) + " fps\r\n"; tbxInfo.Text += "Bitrate : " + ff.VideoBitrate(num) + " Kbps\r\n"; v_num += 1; } //Аудио треки int a_count = ff.AudioStreams().Count, a_num = 1; foreach (int num in ff.AudioStreams()) { tbxInfo.Text += "\r\nAudio stream #" + a_num + ":\r\n"; tbxInfo.Text += "ID : 0." + num + Environment.NewLine; tbxInfo.Text += "Codec : " + ff.StreamCodec(num) + Environment.NewLine; tbxInfo.Text += "Channels : " + ff.StreamChannels(num) + Environment.NewLine; tbxInfo.Text += "Samplerate : " + ff.StreamSamplerate(num) + " Hz\r\n"; tbxInfo.Text += "Language : " + ff.StreamLanguage(num) + Environment.NewLine; tbxInfo.Text += "Bitrate : " + ff.StreamBitrate(num) + " Kbps\r\n"; tbxInfo.Text += "Bits : " + ff.StreamBits(num) + Environment.NewLine; a_num += 1; } } } catch (Exception ex) { ErrorException(ex); } finally { CloseEXE(); CloseFFInfo(); } }