示例#1
0
 private void SetMPEG4Configuration(
     Media.VideoEncoderConfiguration config,
     Media.Mpeg4Options options,
     Media.VideoResolution resolution,
     int?framerate,
     int?bitrate)
 {
     config.Encoding        = Media.VideoEncoding.MPEG4;
     config.MPEG4           = new Media.Mpeg4Configuration();
     config.MPEG4.GovLength = options.GovLengthRange.Max < 30 ? options.GovLengthRange.Max : 30;
     if (config.MPEG4.GovLength < options.GovLengthRange.Min)
     {
         config.MPEG4.GovLength = options.GovLengthRange.Min;
     }
     if (options.Mpeg4ProfilesSupported.Length > 0)
     {
         config.MPEG4.Mpeg4Profile = options.Mpeg4ProfilesSupported[0];
     }
     if ((config.RateControl == null) && (framerate.HasValue || bitrate.HasValue))
     {
         config.RateControl = new Media.VideoRateControl();
     }
     if (config.RateControl != null)
     {
         config.RateControl.FrameRateLimit   = framerate.HasValue ? framerate.Value : options.FrameRateRange.Max;
         config.RateControl.EncodingInterval = options.EncodingIntervalRange.Min;
         if (bitrate.HasValue)
         {
             config.RateControl.BitrateLimit = bitrate.Value;
         }
     }
     config.Resolution = resolution;
 }
示例#2
0
 private void SetJPEGConfiguration(
     Media.VideoEncoderConfiguration config,
     Media.JpegOptions options,
     Media.VideoResolution resolution,
     int?framerate,
     int?bitrate)
 {
     config.Encoding = Media.VideoEncoding.JPEG;
     if ((config.RateControl == null) && (framerate.HasValue || bitrate.HasValue))
     {
         config.RateControl = new Media.VideoRateControl();
     }
     if (config.RateControl != null)
     {
         config.RateControl.FrameRateLimit   = framerate.HasValue ? framerate.Value : options.FrameRateRange.Max;
         config.RateControl.EncodingInterval = options.EncodingIntervalRange.Min;
         if (bitrate.HasValue)
         {
             config.RateControl.BitrateLimit = bitrate.Value;
         }
     }
     config.Resolution = resolution;
 }