编辑: 紫甘兰 2014-04-19

// 设置分辨率为 1280x720, 码率为 1500kbps config.videoWidth = 1280;

config.videoHeight = 720;

config.videoBitrate = 1500;

config.videoFramerate = 20;

config.videoGOP = 2;

config.audioSampleRate = 48000;

config.audioBitrate = 64;

config.audioChannels = 2;

// 设置混流后主播的画面位置 TRTCMixUser *broadCaster = [[TRTCMixUser alloc] init];

实时音视频 版权所有:腾讯云计算(北京)有限责任公司 第14 共38页broadCaster.userId = @ broadcaster ;

// 以主播uid为broadcaster为例 broadCaster.zOrder = 0;

// 铺满屏幕并放到最下面 broadCaster.rect = CGRectMake(0, 0, 1080, 720);

// 设置观众位置, 以一个观众放到左下角为例, 左下角边距10个象素 TRTCMixUser *audience = [[TRTCMixUser alloc] init];

audience.userId = @ audience ;

// 以观众uid为audience为例 audience.zOrder = 1;

// 置于主播画面之上 audience.rect = CGRectMake(10, 470, 360, 240);

//放到左下角 config.mixUsers = @[broadcaster, audience];

[trtcCloud startCloudMixTranscoding:config];

} Java //开启云端混流转码 public void enableTranscoding() { TRTCCloudDef.TRTCTranscodingConfig config = new TRTCCloudDef.TRTCTranscodingConfig();

// 设置分辨率为 1280x720, 码率为 1500kbps config.videoWidth = 1080;

config.videoHeight = 720;

config.videoBitrate = 1500;

config.audioSampleRate = 48000;

config.audioBitrate = 64;

config.audioChannels = 2;

// 设置混流后主播的画面位置 TRTCCloudDef.TRTCMixUser broadCaster = new TRTCCloudDef.TRTCMixUser();

broadCaster.userId = broadcaster ;

// 以主播uid为broadcaster为例 // 铺满屏幕并放到最下面 broadCaster.zOrder = 0;

broadCaster.x = 0;

broadCaster.y = 0;

broadCaster.width = 1080;

broadCaster.height = 720;

TRTCCloudDef.TRTCMixUser audience = new TRTCCloudDef.TRTCMixUser();

audience.userId = audience ;

// 以观众uid为audience为例 // 放到左下角,置于主播画面之上 audience.zOrder = 1;

audience.x = 10;

audience.y = 470;

audience.width = 360;

audience.height = 240;

实时音视频 版权所有:腾讯云计算(北京)有限责任公司 第15 共38页config.mixUsers = new ArrayList();

config.mixUsers.add(broadCaster);

config.mixUsers.add(audience);

trtcCloud.startCloudMixTranscoding(config);

} C++ // 开启云端混流转码 void enableTranscoding() { TRTCTranscodingConfig config;

// 设置分辨率为 1280x720, 码率为 1500kbps config.videoWidth = 1080;

config.videoHeight = 720;

config.videoBitrate = 1500;

config.audioSampleRate = 48000;

config.audioBitrate = 64;

config.audioChannels = 2;

std::vector mixUsers;

// 设置混流后主播的画面位置 TRTCMixUser broadCaster;

broadCaster.userId = broadcaster ;

// 以主播uid为broadcaster为例 broadCaster.zOrder = 0;

// 铺满屏幕并放到最下面 broadCaster.rect.left = 0;

broadCaster.rect.top = 0;

broadCaster.rect.right = 1280;

broadCaster.rect.bottom = 720;

// 设置观众位置, 以一个观众放到左下角为例, 左下角边距10个象素 TRTCMixUser audience;

audience.userId = audience ;

// 以观众uid为audience为例 audience.zOrder = 1;

// 放到左下角,置于主播画面之上 audience.rect.left = 920;

audience.rect.top = 480;

audience.rect.right = 1080;

audience.rect.bottom = 720;

mixUsers.push_back(std::move(broadCaster));

mixUsers.push_back(std::move(audience));

实时音视频 版权所有:腾讯云计算(北京)有限责任公司 第16 共38页config.mixUsersArray = &

下载(注:源文件不在本站服务器,都将跳转到源网站下载)
备用下载
发帖评论
相关话题
发布一个新话题