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"