开发者社区> 问答> 正文

视频转码如何获知转码状态


展开
收起
1786534486667868 2018-09-28 16:51:23 1819 0
1 条回答
写回答
取消 提交回答
  • 阿里云ping https://ping.gaomeluo.com/aliyun/

    1、通过轮询的方式,查询转码任务状态:

    通过查询转码作业(QueryJobList),可以获取转码任务的状态,根据返回值的state字段的值,可以判断任务当前的状态:

      {

         "QueryJobListResponse":{
             "RequestId":"58CBF1B8-048C-4550-B59C-F6EA57A8CEB6",
             "JobList": {
                "Job": [{
                    "JobId": "31fa3c9ca8134f9cec2b4b0b0f787830",
                    "Input": {
                        "Bucket": "example-bucket",
                        "Location": "oss-cn-hangzhou",
                        "Object": "example.flv"
                    },
                    "Output": {
                        "OutputFile": {
                            "Bucket": "example-bucket",
                            "Location": "oss-cn-hangzhou",
                            "Object": "example-output.flv"
                        },
                        "TemplateId": "0001-01",
                        "WaterMarkList": {
                            "WaterMark": [{
                                "InputFile": {
                                "Bucket": "example-bucket",
                                "Location": "oss-cn-hangzhou",
                                "Object": "example-logo.png"
                                },
                                "WaterMarkTemplateId": "88c6ca184c0e47098a5b665e2a126797"
                            }]                    },
                        "Properties":{
                                    "Streams":{
                                        "VideoStreamList":{
                                            "VideoStream":[
                                                {
                                                    "Index":"1",
                                                    "CodecName":"h264",
                                                    "CodecLongName":"H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10",
                                                    "Profile":"High",
                                                    "CodecTimeBase":"1001/48000",
                                                    "CodecTagString":"[0][0][0][0]",
                                                    "CodecTag":"0x0000",
                                                    "Width":"1920",
                                                    "Height":"1080",
                                                    "HasBFrames":"1",
                                                    "Sar":"1:1",
                                                    "Dar":"16:9",
                                                    "PixFmt":"yuv420p",
                                                    "Level":"41",
                                                    "Fps":"25",
                                                    "AvgFPS":"24000/1001",
                                                    "Timebase":"1/1000",
                                                    "StartTime":"0.042000",
                                                    "Duration":"100",
                                                    "Bitrate":"30541090",
                                                    "NumFrames":"100",
                                                    "Lang":"eng",
                                                    "NetworkCost":{
                                                        "PreloadTime":"8",
                                                        "CostBandwidth":"10",
                                                        "AvgBitrate":"300.34"
                                                    }                                            }
                                            ]                                    },
                                        "AudioStreamList":{
                                            "AudioStream":[
                                                {
                                                    "Index":"1",
                                                    "CodecName":"dca",
                                                    "CodecTimeBase":"1/48000",
                                                    "CodecLongName":"DCA (DTS Coherent Acoustics)",
                                                    "CodecTagString":"[0][0][0][0]",
                                                    "CodecTag":"0x0000",
                                                    "SampleFmt":"fltp",
                                                    "Samplerate":"48000",
                                                    "Channels":"2",
                                                    "ChannelLayout":"5.1(side)",
                                                    "Timebase":"1/1000",
                                                    "StartTime":"0.042000",
                                                    "Duration":"123",
                                                    "Bitrate":"1536000",
                                                    "NumFrames":"123",
                                                    "Lang":"eng"
                                                }
                                            ]                                    },
                                        "SubtitleStreamList":{
                                            "SubtitleStream":[
                                                {
                                                    "Index":"3",
                                                    "Lang":"eng"
                                                }
                                            ]                                    }                                },
                                    "Format":{
                                        "NumStreams":"1",
                                        "NumPrograms":"2",
                                        "FormatName":"matroska,webm",
                                        "FormatLongName":"Matroska / WebM",
                                        "StartTime":"0.042000",
                                        "Duration":"17.600000",
                                        "Size":"70569598",
                                        "Bitrate":"32077090"
                                    }                          },
                            "UserData":"testid-001"
                    },
                    "State": "Submitted",
                    "Code": "",
                    "Message": "",
                    "Percent": 0,
                    "PipelineId": "88c6ca184c0e47098a5b665e2a126797",
                    "CreationTime":"2014-01-10T12:00:00Z"

                }]        }     }    }

    具体的作业状态:Submitted表示作业已提交,Transcoding表示转码中,TranscodeSuccess表示转码成功,TranscodeFail表示转码失败,TranscodeCancelled表示转码取消

    接口的详细说明参见:

    https://help.aliyun.com/document_detail/mts/api-reference/trans-ossfile/QueryJobList.html?spm=5176.product8315085_mts.6.103.Y5Yh1N

     

    2、利用消息通知功能,接收转码任务结果:

    转码作业结束时,媒体转码会利用MNS的消息通知功能,向客户配置的URL推送任务执行信息。

    详细配置方法说明参见:【点此查看

     

    HTTP的消息接收服务 Java 实现示例:【点此下载

     

    如果问题还未能解决,请联系售后技术支持

    望采纳,谢谢🙏

    2018-09-28 17:39:39
    赞同 1 展开评论 打赏
问答分类:
问答地址:
问答排行榜
最热
最新

相关电子书

更多
白山直播CDN流传递链路优化实践 立即下载
直播CDN-X - 白山直播CDN流传递链路优化 立即下载
全景视频的播放及优化 立即下载