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

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

#  QNCustomVideoTrack

最近更新时间: 2022-03-23 22:16:19

本地视频自定义导入 Track 类

Hierarchy

  * [QNTrack](https://developer.qiniu.com/rtc/9412/qncustomvideotrack/9452/QNTrack)
    * [QNLocalTrack](https://developer.qiniu.com/rtc/9412/qncustomvideotrack/9422/QNLocalTrack)
      * [QNLocalVideoTrack](https://developer.qiniu.com/rtc/9412/qncustomvideotrack/9424/QNLocalVideoTrack)
        * [QNCameraVideoTrack](https://developer.qiniu.com/rtc/9412/qncustomvideotrack/9404/QNCameraVideoTrack)
        * [QNScreenVideoTrack](https://developer.qiniu.com/rtc/9412/qncustomvideotrack/9448/QNScreenVideoTrack)
        * QNCustomVideoTrack 
      * [QNLocalAudioTrack](https://developer.qiniu.com/rtc/9412/qncustomvideotrack/9420/QNLocalAudioTrack)
        * [QNMicrophoneAudioTrack](https://developer.qiniu.com/rtc/9412/qncustomvideotrack/9433/QNMicrophoneAudioTrack)
        * [QNCustomAudioTrack](https://developer.qiniu.com/rtc/9412/qncustomvideotrack/9409/QNCustomAudioTrack)
    * [QNRemoteTrack](https://developer.qiniu.com/rtc/9412/qncustomvideotrack/9440/QNRemoteTrack)
      * [QNRemoteVideoTrack](https://developer.qiniu.com/rtc/9412/qncustomvideotrack/9443/QNRemoteVideoTrack)
      * [QNRemoteAudioTrack](https://developer.qiniu.com/rtc/9412/qncustomvideotrack/9438/QNRemoteAudioTrack)

Index

Core Methods

  * GetTrackID
  * GetUserID
  * GetTag
  * IsAudio
  * IsVideo
  * IsMuted
  * SetMuted
  * SetVideoFrameListener
  * Play
  * SendSEI
  * StartCrop
  * StopCrop
  * StartScale
  * StopScale
  * StartCapture
  * StopCapture
  * PushVideoFrame

Core Methods

GetTrackID

  * virtual const std::string& GetTrackID() = 0
  * 获取 TrackID

Returns string

GetUserID

  * virtual const std::string& GetUserID() = 0
  * 获取 UserID

Returns string

GetTag

  * virtual const std::string& GetTag() = 0
  * 获取 Tag

Returns string

IsAudio

  * virtual bool IsAudio() = 0
  * 是否为音频 track

Returns bool

IsVideo

  * virtual bool IsVideo() = 0
  * 是否为视频 track

Returns bool

IsMuted

  * virtual bool IsMuted() = 0
  * 是否 muted

Returns bool

SetMuted

  * virtual void SetMuted(bool muted) = 0
  * 设置是否静默该 track，静默后，SDK 将会发送静默帧数据

Parameters

    * muted: bool 

是否静默

SetVideoFrameListener

  * virtual void SetVideoFrameListener([QNVideoFrameListener](https://developer.qiniu.com/rtc/9412/qncustomvideotrack/11326/QNVideoFrameListener)* listener) = 0
  * 设置视频数据监听

Parameters

    * listener: [QNVideoFrameListener](https://developer.qiniu.com/rtc/9412/qncustomvideotrack/11326/QNVideoFrameListener)

视频数据监听接口

Play

  * virtual void Play(QNView& view) = 0
  * 设置本地渲染参数

Parameters

    * view: [QNView](https://developer.qiniu.com/rtc/9412/qncustomvideotrack/11328/QNView)

渲染参数

SendSEI

  * virtual void SendSEI(std::string& message,std::string& uuid,int32_t repeat_count) = 0
  * 发送 SEI

Parameters

    * message: string 

消息内容

    * uuid: string 

唯一 ID

    * repeat_count: int 

重复次数, -1 为每一帧都发送

StartCrop

  * virtual void StartCrop(uint32_t crop_x,uint32_t crop_y,int32_t crop_width,int32_t crop_height) = 0
  * 开启原始帧裁剪功能，设置参数要求如下，如果设置不正确，则输出原始图像

Parameters

    * crop_x: uint32_t 

开始裁减的 X 坐标点，原点为左上角，必须落在原图之内

    * crop_y: uint32_t 

开始裁减的 Y 坐标点，原点为左上角，必须落在原图之内

    * crop_width: int32_t 

目标图像宽度，必须为 4 的整数倍，如果是裁剪模式，crop_x和 crop_y，裁剪图像必须在原始图像之内

    * crop_height: int32_t 

目标图像高度，必须为 4 的整数倍，如果是裁剪模式，crop_x 和 crop_y，裁剪图像必须在原始图像之内

StopCrop

  * virtual void StopCrop() = 0
  * 关闭裁剪功能

StartScale

  * virtual void StartScale(int32_t dst_width, int32_t dst_height) = 0
  * 开启原始帧缩放功能，设置参数要求如下，如果设置不正确，则输出原始图像

Parameters

    * dst_width: int32_t 

目标图像宽度，必须为 4 的整数倍

    * dst_height: int32_t 

目标图像高度，必须为 4 的整数倍

StopScale

  * virtual void StopScale() = 0
  * 关闭缩放功能

StartCapture

  * virtual void StartCapture() = 0
  * 开启摄像头采集

StopCapture

  * virtual void StopCapture() = 0
  * 关闭摄像头采集

PushVideoFrame

  * virtual int PushVideoFrame(const uint8_t* data,const uint32_t data_size,const int32_t width,const int32_t height,const int64_t timestamp_us,QNVideoFrameType video_frame_type,QNVideoRotation rotation,bool mirror = false) = 0
  * 推送自定义视频帧

Parameters

    * data: uint8_t* 

视频数据

    * data_size: uint32_t 

数据长度

    * width: int32_t 

视频宽

    * height: int32_t 

视频高

    * int64_t: timestamp_us 

时间戳，单位:微妙

    * video_frame_type: [QNVideoFrameType](https://developer.qiniu.com/rtc/9412/qncustomvideotrack/11324/QNVideoFrameType)

视频原始格式，支持：kI420 kYUY2 kRGB24

    * rotation: [QNVideoRotation](https://developer.qiniu.com/rtc/9412/qncustomvideotrack/9462/QNVideoRotation)

导入后旋转角度，如果不需要旋转则使用默认值 kVideoRotation0 即可

    * mirror: bool 

是否镜像

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