private static Stream TranslateVideoStream(MediaInfoLib.MediaInfo m, int num)
        {
            Stream s = new Stream
            {
                Id         = m.GetByte(StreamKind.Video, num, "UniqueID"),
                Codec      = TranslateCodec(m.Get(StreamKind.Video, num, "Codec")),
                CodecID    = m.Get(StreamKind.Video, num, "CodecID"),
                StreamType = 1,
                Width      = m.GetInt(StreamKind.Video, num, "Width"),
                Height     = m.GetInt(StreamKind.Video, num, "Height"),
                Duration   = m.GetInt(StreamKind.Video, num, "Duration")
            };
            string title = m.Get(StreamKind.Video, num, "Title");

            if (!string.IsNullOrEmpty(title))
            {
                s.Title = title;
            }

            string lang = m.Get(StreamKind.Video, num, "Language/String3");

            if (!string.IsNullOrEmpty(lang))
            {
                s.LanguageCode = PostTranslateCode3(lang);
            }
            string lan = PostTranslateLan(GetLanguageFromCode3(lang, m.Get(StreamKind.Video, num, "Language/String1")));

            if (!string.IsNullOrEmpty(lan))
            {
                s.Language = lan;
            }
            int brate = BiggerFromList(m.Get(StreamKind.Video, num, "BitRate"));

            if (brate != 0)
            {
                s.Bitrate = (int)Math.Round(brate / 1000F);
            }
            string stype = m.Get(StreamKind.Video, num, "ScanType");

            if (!string.IsNullOrEmpty(stype))
            {
                s.ScanType = stype.ToLower();
            }
            s.RefFrames = m.GetByte(StreamKind.Video, num, "Format_Settings_RefFrames");
            string fprofile = m.Get(StreamKind.Video, num, "Format_Profile");

            if (!string.IsNullOrEmpty(fprofile))
            {
                int a = fprofile.ToLower(CultureInfo.InvariantCulture).IndexOf("@", StringComparison.Ordinal);
                if (a > 0)
                {
                    s.Profile = TranslateProfile(s.Codec,
                                                 fprofile.ToLower(CultureInfo.InvariantCulture).Substring(0, a));
                    if (int.TryParse(TranslateLevel(fprofile.ToLower(CultureInfo.InvariantCulture).Substring(a + 1)),
                                     out int level))
                    {
                        s.Level = level;
                    }
                }
                else
                {
                    s.Profile = TranslateProfile(s.Codec, fprofile.ToLower(CultureInfo.InvariantCulture));
                }
            }
            float rot = m.GetFloat(StreamKind.Video, num, "Rotation");

            if (rot != 0)
            {
                switch (rot)
                {
                case 90F:
                    s.Orientation = 9;
                    break;

                case 180F:
                    s.Orientation = 3;
                    break;

                case 270F:
                    s.Orientation = 6;
                    break;
                }
            }
            string muxing = m.Get(StreamKind.Video, num, "MuxingMode");

            if (!string.IsNullOrEmpty(muxing))
            {
                if (muxing.ToLower(CultureInfo.InvariantCulture).Contains("strip"))
                {
                    s.HeaderStripping = 1;
                }
            }
            string cabac = m.Get(StreamKind.Video, num, "Format_Settings_CABAC");

            if (!string.IsNullOrEmpty(cabac))
            {
                s.Cabac = (byte)(cabac.ToLower(CultureInfo.InvariantCulture) == "yes" ? 1 : 0);
            }
            if (s.Codec == "h264")
            {
                if (s.Level == 31 && s.Cabac == 0)
                {
                    s.HasScalingMatrix = 1;
                }
                else
                {
                    s.HasScalingMatrix = 0;
                }
            }
            string fratemode = m.Get(StreamKind.Video, num, "FrameRate_Mode");

            if (!string.IsNullOrEmpty(fratemode))
            {
                s.FrameRateMode = fratemode.ToLower(CultureInfo.InvariantCulture);
            }
            float frate = m.GetFloat(StreamKind.Video, num, "FrameRate");

            if (frate == 0.0F)
            {
                frate = m.GetFloat(StreamKind.Video, num, "FrameRate_Original");
            }
            if (frate != 0.0F)
            {
                s.FrameRate = frate;
            }
            string colorspace = m.Get(StreamKind.Video, num, "ColorSpace");

            if (!string.IsNullOrEmpty(colorspace))
            {
                s.ColorSpace = colorspace.ToLower(CultureInfo.InvariantCulture);
            }
            string chromasubsampling = m.Get(StreamKind.Video, num, "ChromaSubsampling");

            if (!string.IsNullOrEmpty(chromasubsampling))
            {
                s.ChromaSubsampling = chromasubsampling.ToLower(CultureInfo.InvariantCulture);
            }


            byte bitdepth = m.GetByte(StreamKind.Video, num, "BitDepth");

            if (bitdepth != 0)
            {
                s.BitDepth = bitdepth;
            }
            string id = m.Get(StreamKind.Video, num, "ID");

            if (!string.IsNullOrEmpty(id))
            {
                if (byte.TryParse(id, out byte idx))
                {
                    s.Index = idx;
                }
            }
            string qpel = m.Get(StreamKind.Video, num, "Format_Settings_QPel");

            if (!string.IsNullOrEmpty(qpel))
            {
                s.QPel = (byte)(qpel.ToLower(CultureInfo.InvariantCulture) == "yes" ? 1 : 0);
            }
            string gmc = m.Get(StreamKind.Video, num, "Format_Settings_GMC");

            if (!string.IsNullOrEmpty(gmc))
            {
                s.GMC = gmc;
            }
            string bvop = m.Get(StreamKind.Video, num, "Format_Settings_BVOP");

            if (!string.IsNullOrEmpty(bvop) && (s.Codec != "mpeg1video"))
            {
                if (bvop == "No")
                {
                    s.BVOP = 0;
                }
                else if ((bvop == "1") || (bvop == "Yes"))
                {
                    s.BVOP = 1;
                }
            }
            string def = m.Get(StreamKind.Text, num, "Default");

            if (!string.IsNullOrEmpty(def))
            {
                if (def.ToLower(CultureInfo.InvariantCulture) == "yes")
                {
                    s.Default = 1;
                }
            }
            string forced = m.Get(StreamKind.Text, num, "Forced");

            if (!string.IsNullOrEmpty(forced))
            {
                if (forced.ToLower(CultureInfo.InvariantCulture) == "yes")
                {
                    s.Forced = 1;
                }
            }
            s.PA = m.GetFloat(StreamKind.Video, num, "PixelAspectRatio");
            string sp2 = m.Get(StreamKind.Video, num, "PixelAspectRatio_Original");

            if (!string.IsNullOrEmpty(sp2))
            {
                s.PA = System.Convert.ToSingle(sp2);
            }
            if ((s.PA != 1.0) && s.Width != 0)
            {
                if (s.Width != 0)
                {
                    float width = s.Width;
                    width *= s.PA;
                    s.PixelAspectRatio = (int)Math.Round(width) + ":" + s.Width;
                }
            }

            return(s);
        }