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

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

#  QNCameraVideoTrackConfig

最近更新时间: 2022-05-12 20:09:10

摄像头视频采集 Track 的配置类

Index

Core Methods

  * QNCameraVideoTrackConfig
  * QNCameraVideoTrackConfig
  * getTag
  * getCameraFacing
  * setCameraFacing
  * getVideoCaptureConfig
  * setVideoCaptureConfig
  * getVideoEncoderConfig
  * setVideoEncoderConfig
  * isMultiProfileEnabled
  * setMultiProfileEnabled

Core Methods

QNCameraVideoTrackConfig

  * QNCameraVideoTrackConfig()
  * 默认构造方法，tag 为 ""

Returns
[QNCameraVideoTrackConfig](https://developer.qiniu.com/rtc/8642/QNCameraVideoTrackConfig/8642/QNCameraVideoTrackConfig)

QNCameraVideoTrackConfig

  * QNCameraVideoTrackConfig(String tag)
  * 构造方法

Parameters

    * tag: String 

Track 的标签，可通过它来携带 Track 信息，区分 Track 对象

Returns
[QNCameraVideoTrackConfig](https://developer.qiniu.com/rtc/8642/QNCameraVideoTrackConfig/8642/QNCameraVideoTrackConfig)

getTag

  * String getTag()
  * 获取当前设置的标签

Returns 当前设置的标签

getCameraFacing

  * [QNCameraFacing](https://developer.qiniu.com/rtc/8642/QNCameraVideoTrackConfig/8638/QNCameraFacing) getCameraFacing()
  * 获取当前摄像头朝向

Returns 当前摄像头朝向

setCameraFacing

  * [QNCameraVideoTrackConfig](https://developer.qiniu.com/rtc/8642/QNCameraVideoTrackConfig/8642/QNCameraVideoTrackConfig) setCameraFacing([QNCameraFacing](https://developer.qiniu.com/rtc/8642/QNCameraVideoTrackConfig/8638/QNCameraFacing) cameraFacing)
  * 设置摄像头朝向，默认为前置

Parameters

    * cameraFacing: [QNCameraFacing](https://developer.qiniu.com/rtc/8642/QNCameraVideoTrackConfig/8638/QNCameraFacing)

摄像头朝向，见
[QNCameraFacing](https://developer.qiniu.com/rtc/8642/QNCameraVideoTrackConfig/8638/QNCameraFacing)

Returns
[QNCameraVideoTrackConfig](https://developer.qiniu.com/rtc/8642/QNCameraVideoTrackConfig/8642/QNCameraVideoTrackConfig)

getVideoCaptureConfig

  * [QNVideoCaptureConfig](https://developer.qiniu.com/rtc/8642/QNCameraVideoTrackConfig/8700/QNVideoCaptureConfig) getVideoCaptureConfig()
  * 获取摄像头采集配置

Returns 摄像头采集配置

setVideoCaptureConfig

  * [QNCameraVideoTrackConfig](https://developer.qiniu.com/rtc/8642/QNCameraVideoTrackConfig/8642/QNCameraVideoTrackConfig) setVideoCaptureConfig([QNVideoCaptureConfig](https://developer.qiniu.com/rtc/8642/QNCameraVideoTrackConfig/8700/QNVideoCaptureConfig) videoCaptureConfig)
  * 设置摄像头采集配置，默认值为 QNVideoCaptureConfigPreset.CAPTURE_640x480

> 1\. 您可使用 SDK 预设的采集配置
> [QNVideoCaptureConfigPreset](https://developer.qiniu.com/rtc/8642/QNCameraVideoTrackConfig/8731/QNVideoCaptureConfigPreset)，也可通过自定义
> [QNVideoCaptureConfig](https://developer.qiniu.com/rtc/8642/QNCameraVideoTrackConfig/8700/QNVideoCaptureConfig)
> 进行采集参数配置
>
> 2\. 实际场景中可能会出现实际采集分辨率和 QNVideoCaptureConfig 配置不符的情况，这是因为 Camera
> 不支持配置中的分辨率导致的，若 SDK 内部策略选择的分辨率不符合您的需求，您可以通过监听
> [QNCameraEventListener.onCameraOpened](https://developer.qiniu.com/rtc/8642/QNCameraVideoTrackConfig/8637)
> 回调并返回指定的索引来选择符合您需求的采集分辨率

Parameters

    * videoCaptureConfig: [QNVideoCaptureConfig](https://developer.qiniu.com/rtc/8642/QNCameraVideoTrackConfig/8700/QNVideoCaptureConfig)

摄像头采集配置，见
[QNVideoCaptureConfig](https://developer.qiniu.com/rtc/8642/QNCameraVideoTrackConfig/8700/QNVideoCaptureConfig)

Returns
[QNCameraVideoTrackConfig](https://developer.qiniu.com/rtc/8642/QNCameraVideoTrackConfig/8642/QNCameraVideoTrackConfig)

getVideoEncoderConfig

  * [QNVideoEncoderConfig](https://developer.qiniu.com/rtc/8642/QNCameraVideoTrackConfig/8701/QNVideoEncoderConfig) getVideoEncoderConfig()
  * 获取视频编码配置

Returns 当前视频编码配置

setVideoEncoderConfig

  * [QNCameraVideoTrackConfig](https://developer.qiniu.com/rtc/8642/QNCameraVideoTrackConfig/8642/QNCameraVideoTrackConfig) setVideoEncoderConfig([QNVideoEncoderConfig](https://developer.qiniu.com/rtc/8642/QNCameraVideoTrackConfig/8701/QNVideoEncoderConfig) config)
  * 设置视频编码配置，默认值分辨率为 640x480，码率为 800kbps，帧率为 20

> 1\. 编码分辨率建议和采集分辨率保持一致，不一致时 SDK 将会对采集帧做裁剪或者缩放再编码输出。
>
> 2\. 如果当前设置
> [QNRTCSetting.setHWCodecEnabled](https://developer.qiniu.com/rtc/8642/QNCameraVideoTrackConfig/8686)
> 为 true，考虑到硬件平台的兼容性，将会对分辨率做对齐处理，因此，可能会出现编码分辨率和预期不符的情况，此为正常现象。对齐规则如下：
>
> \- 华为机型 32 对齐
>
> \- 其他机型 16 对齐

Parameters

    * config: [QNVideoEncoderConfig](https://developer.qiniu.com/rtc/8642/QNCameraVideoTrackConfig/8701/QNVideoEncoderConfig)

视频编码配置，见
[QNVideoEncoderConfig](https://developer.qiniu.com/rtc/8642/QNCameraVideoTrackConfig/8701/QNVideoEncoderConfig)

Returns
[QNCameraVideoTrackConfig](https://developer.qiniu.com/rtc/8642/QNCameraVideoTrackConfig/8642/QNCameraVideoTrackConfig)

isMultiProfileEnabled

  * boolean isMultiProfileEnabled()
  * 判断当前是否开启了大小流

Returns 大小流开启状况，开启为 true ，关闭为 false

setMultiProfileEnabled

  * [QNCameraVideoTrackConfig](https://developer.qiniu.com/rtc/8642/QNCameraVideoTrackConfig/8642/QNCameraVideoTrackConfig) setMultiProfileEnabled(boolean enabled)
  * 设置是否开启大小流，默认不开启

关于大小流功能，可参考[视频大小流使用指南](https://developer.qiniu.com/rtc/development_guidelines/8728/multi-
stream-android)

Parameters

    * enabled: boolean 

是否开启大小流功能

Returns
[QNCameraVideoTrackConfig](https://developer.qiniu.com/rtc/8642/QNCameraVideoTrackConfig/8642/QNCameraVideoTrackConfig)

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