6. 直播实时转码

6.1 获取直播实时转码地址

6.1.1 接口说明

该接口用于:获取直播实时转码相关地址。

6.1.2 请求说明

POST https://vcloud.163.com/app/transcodeAddress HTTP/1.1
Content-Type: application/json;charset=utf-8

6.1.3 参数说明

参数 类型 说明 必须
cid String 频道ID

6.1.4 curl请求示例

curl -X POST -H "Content-Type: application/json" -H "AppKey: 29781bbc4db54742a3ebcxxxxxxxxxxx" -H "Nonce: 12345" -H "CurTime: 1469171950571" -H "CheckSum: 4ba6ca70c685eb900917e423eadaxxxxxxxxxxxxx" -d '{"cid": "cidxxxxxxxxx"}' https://vcloud.163.com/app/transcodeAddress

6.1.5 返回说明

参数 类型 说明
code int 错误码
msg String 错误信息
requestId String 全局唯一请求id
status int 拉流转码状态0->暂未开通,1->已开通
pushUrl String 推流地址
httpPullUrl String http拉流地址
hlsPullUrl String hls拉流地址
rtmpPullUrl String rtmp拉流地址
transcodeHttpPullUrl String 实时转码http拉流地址,当status=0时该数据结点不存在
transcodeRtmpPullUrl String 实时转码rtmp拉流地址,当status=0时该数据结点不存在
transcodeHlsPullUrl String 实时转码hls拉流地址,当status=0时该数据结点不存在
1280 String 16:9,1280x720,1600k格式拉流地址
960 String 16:9,960x540,1000k格式拉流地址
640 String 16:9,640x360,600k格式拉流地址
320 String 16:9,320x180,300k格式拉流地址
540 String 9:16,540x960,1000k格式拉流地址
360 String 9:16,360x640,600k格式拉流地址
180 String 9:16,180x320,300k格式拉流地址
//返回结果格式
"Content-Type": "application/json; charset=utf-8"
{
    "code" : XXX,
    "msg": XXX,
}

//成功结果示例
"Content-Type": "application/json; charset=utf-8"
{

    "code":200,
    "requestId":"xxxxxxxxx",
    "ret":{

        "status":1,

        "pushUrl":"rtmp://pxxxxxx.live.126.net/live/cidxxxxxxxxx?wsSecret=582e02209271e6bf7fc762e68a7c51cc&wsTime=1469416637",
        "httpPullUrl":"http://flvxxxxx.live.126.net/live/频道id.flv",
        "hlsPullUrl":"http://pullhlsxxxxx.live.126.net/live/频道id/playlist.m3u8",
        "rtmpPullUrl":"http://vxxxxx.live.126.net/live/频道id",

        "transcodeHttpPullUrl":{
            "1280":"http://flvxxxxx.live.126.net/live/频道id_H1.flv",
            "960":"http://flvxxxxx.live.126.net/live/频道id_H2.flv",
            "640":"http://flvxxxxx.live.126.net/live/频道id_H3.flv",
            "320":"http://flvxxxxx.live.126.net/live/频道id_H4.flv",
            "540":"http://flvxxxxx.live.126.net/live/频道id_S1.flv",
            "360":"http://flvxxxxx.live.126.net/live/频道id_S2.flv",
            "180":"http://flvxxxxx.live.126.net/live/频道id_S3.flv"
        },

        "transcodeRtmpPullUrl":{
            "1280":"rtmp://vxxxxx.live.126.net/live/频道id_H1",
            "960":"rtmp://vxxxxx.live.126.net/live/频道id_H2",
            "640":"rtmp://vxxxxx.live.126.net/live/频道id_H3",
            "320":"rtmp://vxxxxx.live.126.net/live/频道id_H4",
            "540":"rtmp://vxxxxx.live.126.net/live/频道id_S1",
            "360":"rtmp://vxxxxx.live.126.net/live/频道id_S2",
            "180":"rtmp://vxxxxx.live.126.net/live/频道id_S3"
        },
        "transcodeHlsPullUrl":
        {
        "1280":"http://pullhlsxxxxx.live.126.net/live/频道id_H1/playlist.m3u8",
            "960":"http://pullhlsxxxxx.live.126.net/live/频道id_H2/playlist.m3u8",
            "640":"http://pullhlsxxxxx.live.126.net/live/频道id_H3/playlist.m3u8",
            "320":"http://pullhlsxxxxx.live.126.net/live/频道id_H4/playlist.m3u8",
            "540":"http://pullhlsxxxxx.live.126.net/live/频道id_S1/playlist.m3u8",
            "360":"http://pullhlsxxxxx.live.126.net/live/频道id_S2/playlist.m3u8",
            "180":"http://pullhlsxxxxx.live.126.net/live/频道id_S3/playlist.m3u8"
        }
    }

}

6.1.6 响应状态码

状态码 含义
200 操作成功
409 用户登录认证失败
602 查询失败:获取直播地址失败
607 用户信息不存在
609 频道ID为空
613 CheckSum为空
614 AppKey为空
615 CurTime为空
617 频道信息与当前用户不匹配
638 访问频率超限,每个应用对该接口限制为80次/秒。