human: 如何处理七牛云的实时音视频QNVideoEncoderConfig

gpt: [实时音视频](https://developer.qiniu.com/rtc) > API 文档 > iOS >QNVideoEncoderConfig

#  QNVideoEncoderConfig

最近更新时间: 2023-08-22 12:06:57

Track 视频编码配置类

Index

Core Properties

  * bitrate
  * bitrate
  * bitrate
  * preference
  * formatPreset

Core Methods

  * defaultVideoEncoderConfig
  * initWithBitrate[1/4]
  * initWithBitrate[2/4]
  * initWithBitrate[3/4]
  * initWithBitrate[4/4]
  * initWithPreference

Core Properties

bitrate

  * @property (nonatomic, assign, readonly) NSUInteger bitrate;
  * Track 的 bitrate (单位 kbps)，默认码率为 600kbps

bitrate

  * @property (nonatomic, assign, readonly) CGSize videoEncodeSize;
  * Track 编码画面大小，默认 480x640

> 若视频编码分辨率无法达到设置值，则以实际采集分辨率为准

bitrate

  * @property (nonatomic, assign, readonly) NSUInteger videoFrameRate;
  * Track 编码帧数，默认 24 帧

> 若视频输入帧数无法达到设置值，则以实际输入帧数为准

preference

  * @property (nonatomic, assign, readonly) [QNDegradationPreference](https://developer.qiniu.com/rtc/11944/QNVideoEncoderConfig-iOS/9254) preference;
  * 视频质量降级模式，默认是 QNDegradationDefault

formatPreset

  * @property (nonatomic, assign, readonly) [QNVideoFormatPreset](https://developer.qiniu.com/rtc/11944/QNVideoEncoderConfig-iOS/9254) formatPreset;
  * 视频编码预设

Core Methods

defaultVideoEncoderConfig

  * \+ (instancetype)defaultVideoEncoderConfig;
  * 初始化默认编码配置

Returns
[QNVideoEncoderConfig](https://developer.qiniu.com/rtc/11944/QNVideoEncoderConfig-
iOS/11944/QNVideoEncoderConfig-iOS)

initWithBitrate[1/4]

  * \- (instancetype)initWithBitrate:(NSUInteger)bitrate;
  * 初始化指定 bitrate 参数的编码配置

Parameters

    * bitrate: NSUInteger 

视频码率，单位 kbps

Returns
[QNVideoEncoderConfig](https://developer.qiniu.com/rtc/11944/QNVideoEncoderConfig-
iOS/11944/QNVideoEncoderConfig-iOS)

initWithBitrate[2/4]

  * \- (instancetype)initWithBitrate:(NSUInteger)bitrate videoEncodeSize:(CGSize)videoEncodeSize;
  * 初始化指定 bitrate、videoEncodeSize 参数的编码配置

Parameters

    * bitrate: NSUInteger 

视频码率，单位 kbps

    * videoEncodeSize: CGSize 

视频编码尺寸

Returns
[QNVideoEncoderConfig](https://developer.qiniu.com/rtc/11944/QNVideoEncoderConfig-
iOS/11944/QNVideoEncoderConfig-iOS)

initWithBitrate[3/4]

  * \- (instancetype)initWithBitrate:(NSUInteger)bitrate videoEncodeSize:(CGSize)videoEncodeSize videoFrameRate:(NSUInteger)videoFrameRate
  * 初始化指定 bitrate、videoEncodeSize、videoFrameRate 参数的编码配置

Parameters

    * bitrate: NSUInteger 

视频码率，单位 kbps

    * videoEncodeSize: CGSize 

视频编码尺寸

    * videoFrameRate: NSUInteger 

视频编码帧率

Returns
[QNVideoEncoderConfig](https://developer.qiniu.com/rtc/11944/QNVideoEncoderConfig-
iOS/11944/QNVideoEncoderConfig-iOS)

initWithBitrate[4/4]

  * \- (instancetype)initWithBitrate:(NSUInteger)bitrate videoEncodeSize:(CGSize)videoEncodeSize videoFrameRate:(NSUInteger)videoFrameRate preference:([QNDegradationPreference](https://developer.qiniu.com/rtc/11944/QNVideoEncoderConfig-iOS/9254))preference
  * 初始化指定 bitrate、videoEncodeSize、videoFrameRate、preference 参数的编码配置

Parameters

    * bitrate: NSUInteger 

视频码率，单位 kbps

    * videoEncodeSize: CGSize 

视频编码尺寸

    * videoFrameRate: NSUInteger 

视频编码帧率

    * preference: [QNDegradationPreference](https://developer.qiniu.com/rtc/11944/QNVideoEncoderConfig-iOS/9254)

视频质量降级模式

Returns
[QNVideoEncoderConfig](https://developer.qiniu.com/rtc/11944/QNVideoEncoderConfig-
iOS/11944/QNVideoEncoderConfig-iOS)

initWithPreference

  * \- (instancetype)initWithPreference:(QNDegradationPreference)preference formatPreset:(QNVideoFormatPreset)formatPreset;
  * 初始化指定 preference、formatPreset 参数的编码配置

Parameters

    * preference: [QNDegradationPreference](https://developer.qiniu.com/rtc/11944/QNVideoEncoderConfig-iOS/9254)

视频质量降级模式

    * formatPreset: [QNVideoFormatPreset](https://developer.qiniu.com/rtc/11944/QNVideoEncoderConfig-iOS/9254)

视频编码预设

Returns
[QNVideoEncoderConfig](https://developer.qiniu.com/rtc/11944/QNVideoEncoderConfig-
iOS/11944/QNVideoEncoderConfig-iOS)

以上内容是否对您有帮助？