Esempio n. 1
0
        private static ASP GetASP(int bitrate)
        {
            ASP result = new ASP();

            switch (bitrate)
            {
            case 400:
                result.Width  = 320;
                result.Height = 180;
                break;

            case 800:
                result.Width  = 416;
                result.Height = 238;
                break;

            case 1600:
                result.Width  = 712;
                result.Height = 400;
                break;

            case 2400:
                result.Width  = 1280;
                result.Height = 720;
                break;

            default:
                throw new ArgumentException(nameof(bitrate));
            }
            return(result);
        }
Esempio n. 2
0
        private static EncodingProfile GetProfile(int bitrate)
        {
            EncodingProfile profile;
            ASP             asp = GetASP(bitrate);

            var serializer = new XmlSerializer(typeof(EncodingProfile));

            using (var stream = new FileStream("Normal.xml", FileMode.Open, FileAccess.Read))
            {
                profile = serializer.Deserialize(stream) as EncodingProfile;
            }

            profile.VideoEncodeRateType = VideoEncodeRateType.AverageBitrate;
            profile.Anamorphic          = Anamorphic.None;
            profile.KeepDisplayAspect   = true;
            profile.VideoBitrate        = bitrate;
            profile.Width  = asp.Width;
            profile.Height = asp.Height;

            return(profile);
        }