开发者社区> 问答> 正文

媒体转码提交转码任务后,如何获得转码状态?

媒体转码提交转码任务后,如何获得转码状态?

展开
收起
保持可爱mmm 2020-03-30 11:35:02 627 0
1 条回答
写回答
取消 提交回答
  • 媒体转码的转码任务是异步的接口,提交转码任务后,可以通过两种方式获得任务的执行状态:

    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 实现示例:【点此下载】

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

    2020-03-30 11:35:55
    赞同 展开评论 打赏
问答排行榜
最热
最新

相关电子书

更多
网络视听规范化时代,视频AI破解直播违规难题 立即下载
阿里云高级开发工程师高深在2018云栖大会·上海峰会中做了题为《网络视听规范化时代,视频AI破解直播违规难题》的分享,就视频内容审核、语音内容审核、复审及取证等方面的内容做了深入的分析。 立即下载
低代码开发师(初级)实战教程 立即下载