tencent cloud

文档反馈

人声分离

最后更新时间:2022-08-09 14:33:56

    功能说明

    数据万象支持自定义设置回调 URL,在任务完成后,系统向该 URL 发送 HTTP POST 请求,请求体中包含通知内容。您可通过配置的回调地址及时了解任务处理的进展和状态,以便进行其他业务操作。

    回调内容

    任务完成后,系统会向您设置的回调地址发送回调内容,该响应体返回为 application/xml 数据,包含完整节点数据的内容展示如下:

    <Response>
      <EventName>TaskFinish</EventName>
      <JobsDetail>
          <Code>Success</Code>
          <CreationTime>2022-07-01T10:12:26+0800</CreationTime>
          <EndTime>2022-07-01T10:12:32+0800</EndTime>
          <Input>
              <BucketId>test-123456789</BucketId>
              <Object>input/demo.mp3</Object>
              <Region>ap-chongqing</Region>
          </Input>
          <JobId>j40644e92f8e311ecb90d0b03267ce0e5</JobId>
          <Message/>
          <Operation>
              <MediaInfo>
                  <Format>
                      <Bitrate>128.147000</Bitrate>
                      <Duration>13.688163</Duration>
                      <FormatLongName>MP2/3 (MPEG audio layer 2/3)</FormatLongName>
                      <FormatName>mp3</FormatName>
                      <NumProgram>0</NumProgram>
                      <NumStream>1</NumStream>
                      <Size>219263</Size>
                      <StartTime>0.025057</StartTime>
                  </Format>
                  <Stream>
                      <Audio>
                          <Bitrate>128.000000</Bitrate>
                          <Channel>2</Channel>
                          <ChannelLayout>stereo</ChannelLayout>
                          <CodecLongName>MP3 (MPEG audio layer 3)</CodecLongName>
                          <CodecName>mp3</CodecName>
                          <CodecTag>0x0000</CodecTag>
                          <CodecTagString>[0][0][0][0]</CodecTagString>
                          <CodecTimeBase>1/14112000</CodecTimeBase>
                          <Duration>13.688163</Duration>
                          <Index>0</Index>
                          <SampleFmt>fltp</SampleFmt>
                          <SampleRate>44100</SampleRate>
                          <StartTime>0.025057</StartTime>
                          <Timebase>1/14112000</Timebase>
                      </Audio>
                      <Audio>
                          <Bitrate>128.000000</Bitrate>
                          <Channel>2</Channel>
                          <ChannelLayout>stereo</ChannelLayout>
                          <CodecLongName>MP3 (MPEG audio layer 3)</CodecLongName>
                          <CodecName>mp3</CodecName>
                          <CodecTag>0x0000</CodecTag>
                          <CodecTagString>[0][0][0][0]</CodecTagString>
                          <CodecTimeBase>1/14112000</CodecTimeBase>
                          <Duration>13.688163</Duration>
                          <Index>0</Index>
                          <SampleFmt>fltp</SampleFmt>
                          <SampleRate>44100</SampleRate>
                          <StartTime>0.025057</StartTime>
                          <Timebase>1/14112000</Timebase>
                      </Audio>
                      <Subtitle/>
                      <Video/>
                  </Stream>
              </MediaInfo>
              <MediaResult>
                  <OutputFile>
                      <Bucket>test-123456789</Bucket>
                      <Md5Info>
                          <Md5>3b883c0462ba845acdf3eb7e30db1a1c</Md5>
                          <ObjectName>output/audio.mp3</ObjectName>
                      </Md5Info>
                      <Md5Info>
                          <Md5>62de6bb513d6105eeeb1a6ab0077cb5a</Md5>
                          <ObjectName>output/backgroud.mp3</ObjectName>
                      </Md5Info>
                      <ObjectName>output/audio.mp3</ObjectName>
                      <ObjectName>output/backgroud.mp3</ObjectName>
                      <ObjectPrefix/>
                      <Region>ap-chongqing</Region>
                  </OutputFile>
              </MediaResult>
              <Output>
                  <AuObject>output/audio.mp3</AuObject>
                  <Bucket>test-123456789</Bucket>
                  <Object>output/backgroud.mp3</Object>
                  <Region>ap-chongqing</Region>
              </Output>
              <UserData>This is my VoiceSeparate job.</UserData>
              <TemplateId>t1f6ac18da8bdc403fa27ac4ffnd7a6sa1</TemplateId>
              <TemplateName>videoseparate_12654</TemplateName>
          </Operation>
          <QueueId>p2242ab62c7c94486915508540933a2c6</QueueId>
          <StartTime>2022-07-01T10:12:27+0800</StartTime>
          <State>Success</State>
          <Tag>VoiceSeparate</Tag>
      </JobsDetail>
    </Response>
    

    具体的数据内容如下:

    节点名称(关键字) 父节点 描述 类型
    Response 保存结果的容器 Container

    Container 节点 Response 的内容:

    节点名称(关键字) 父节点 描述 类型
    EventName Response 固定值,为 TaskFinish String
    JobsDetail Response 任务的详细信息 Container

    Container 节点 JobsDetail 的内容:同提交人声分离任务接口中的 Response.JobsDetail

    如果任务是通过工作流触发的,Response.JobsDetail.Input 还会包含 CosHeaders 节点,类型为 Container 数组。

    Container 节点 CosHeaders 的内容:

    节点名称(关键字) 父节点 描述 类型
    Key Response.JobsDetail.Input.CosHeaders 自定义 Header 的名称 String
    Value Response.JobsDetail.Input.CosHeaders 自定义 Header 的值 String

    如果任务是通过工作流触发的,Response.JobsDetail 还会包含 Workflow 节点,类型为 Container。

    Container 节点 Workflow 的内容:

    节点名称(关键字) 父节点 描述 类型
    RunId Response.Workflow 工作流实例 ID String
    WorkflowId Response.Workflow 工作流 ID String
    WorkflowName Response.Workflow 工作流名称 String
    Name Response.Workflow 工作流节点名称 String

    实际案例

    案例 1:通过任务接口触发的任务回调

    <Response>
      <EventName>TaskFinish</EventName>
      <JobsDetail>
          <Code>Success</Code>
          <CreationTime>2022-07-01T10:12:26+0800</CreationTime>
          <EndTime>2022-07-01T10:12:32+0800</EndTime>
          <Input>
              <BucketId>test-123456789</BucketId>
              <Object>input/demo.mp3</Object>
              <Region>ap-chongqing</Region>
          </Input>
          <JobId>j40644e92f8e311ecb90d0b03267ce0e5</JobId>
          <Message/>
          <Operation>
              <MediaInfo>
                  <Format>
                      <Bitrate>128.147000</Bitrate>
                      <Duration>13.688163</Duration>
                      <FormatLongName>MP2/3 (MPEG audio layer 2/3)</FormatLongName>
                      <FormatName>mp3</FormatName>
                      <NumProgram>0</NumProgram>
                      <NumStream>1</NumStream>
                      <Size>219263</Size>
                      <StartTime>0.025057</StartTime>
                  </Format>
                  <Stream>
                      <Audio>
                          <Bitrate>128.000000</Bitrate>
                          <Channel>2</Channel>
                          <ChannelLayout>stereo</ChannelLayout>
                          <CodecLongName>MP3 (MPEG audio layer 3)</CodecLongName>
                          <CodecName>mp3</CodecName>
                          <CodecTag>0x0000</CodecTag>
                          <CodecTagString>[0][0][0][0]</CodecTagString>
                          <CodecTimeBase>1/14112000</CodecTimeBase>
                          <Duration>13.688163</Duration>
                          <Index>0</Index>
                          <SampleFmt>fltp</SampleFmt>
                          <SampleRate>44100</SampleRate>
                          <StartTime>0.025057</StartTime>
                          <Timebase>1/14112000</Timebase>
                      </Audio>
                      <Audio>
                          <Bitrate>128.000000</Bitrate>
                          <Channel>2</Channel>
                          <ChannelLayout>stereo</ChannelLayout>
                          <CodecLongName>MP3 (MPEG audio layer 3)</CodecLongName>
                          <CodecName>mp3</CodecName>
                          <CodecTag>0x0000</CodecTag>
                          <CodecTagString>[0][0][0][0]</CodecTagString>
                          <CodecTimeBase>1/14112000</CodecTimeBase>
                          <Duration>13.688163</Duration>
                          <Index>0</Index>
                          <SampleFmt>fltp</SampleFmt>
                          <SampleRate>44100</SampleRate>
                          <StartTime>0.025057</StartTime>
                          <Timebase>1/14112000</Timebase>
                      </Audio>
                      <Subtitle/>
                      <Video/>
                  </Stream>
              </MediaInfo>
              <MediaResult>
                  <OutputFile>
                      <Bucket>test-123456789</Bucket>
                      <Md5Info>
                          <Md5>3b883c0462ba845acdf3eb7e30db1a1c</Md5>
                          <ObjectName>output/audio.mp3</ObjectName>
                      </Md5Info>
                      <Md5Info>
                          <Md5>62de6bb513d6105eeeb1a6ab0077cb5a</Md5>
                          <ObjectName>output/backgroud.mp3</ObjectName>
                      </Md5Info>
                      <ObjectName>output/audio.mp3</ObjectName>
                      <ObjectName>output/backgroud.mp3</ObjectName>
                      <ObjectPrefix/>
                      <Region>ap-chongqing</Region>
                  </OutputFile>
              </MediaResult>
              <Output>
                  <AuObject>output/audio.mp3</AuObject>
                  <Bucket>test-123456789</Bucket>
                  <Object>output/backgroud.mp3</Object>
                  <Region>ap-chongqing</Region>
              </Output>
              <UserData>This is my VoiceSeparate job.</UserData>
              <TemplateId>t1f6ac18da8bdc403fa27ac4ffnd7a6sa1</TemplateId>
              <TemplateName>videoseparate_12654</TemplateName>
          </Operation>
          <QueueId>p2242ab62c7c94486915508540933a2c6</QueueId>
          <StartTime>2022-07-01T10:12:27+0800</StartTime>
          <State>Success</State>
          <Tag>VoiceSeparate</Tag>
      </JobsDetail>
    </Response>
    

    案例 2:通过工作流触发的任务回调

    <Response>
      <EventName>TaskFinish</EventName>
      <JobsDetail>
          <Code>Success</Code>
          <CreationTime>2022-07-01T10:12:26+0800</CreationTime>
          <EndTime>2022-07-01T10:12:32+0800</EndTime>
          <Input>
              <BucketId>test-123456789</BucketId>
              <Object>input/demo.mp3</Object>
              <Region>ap-chongqing</Region>
              <CosHeaders>
                  <Key>Content-Type</Key>
                  <Value>video/mp3</Value>
              </CosHeaders>
              <CosHeaders>
                  <Key>x-cos-request-id</Key>
                  <Value>NjJiZDYwYTFfNjUzYTYyNjRfZjEwZl8xMmZhYzY5</Value>
              </CosHeaders>
              <CosHeaders>
                  <Key>EventName</Key>
                  <Value>cos:ObjectCreated:Put</Value>
              </CosHeaders>
              <CosHeaders>
                  <Key>Size</Key>
                  <Value>1326515</Value>
              </CosHeaders>
          </Input>
          <JobId>j40644e92f8e311ecb90d0b03267ce0e5</JobId>
          <Message/>
          <Operation>
              <MediaInfo>
                  <Format>
                      <Bitrate>128.147000</Bitrate>
                      <Duration>13.688163</Duration>
                      <FormatLongName>MP2/3 (MPEG audio layer 2/3)</FormatLongName>
                      <FormatName>mp3</FormatName>
                      <NumProgram>0</NumProgram>
                      <NumStream>1</NumStream>
                      <Size>219263</Size>
                      <StartTime>0.025057</StartTime>
                  </Format>
                  <Stream>
                      <Audio>
                          <Bitrate>128.000000</Bitrate>
                          <Channel>2</Channel>
                          <ChannelLayout>stereo</ChannelLayout>
                          <CodecLongName>MP3 (MPEG audio layer 3)</CodecLongName>
                          <CodecName>mp3</CodecName>
                          <CodecTag>0x0000</CodecTag>
                          <CodecTagString>[0][0][0][0]</CodecTagString>
                          <CodecTimeBase>1/14112000</CodecTimeBase>
                          <Duration>13.688163</Duration>
                          <Index>0</Index>
                          <SampleFmt>fltp</SampleFmt>
                          <SampleRate>44100</SampleRate>
                          <StartTime>0.025057</StartTime>
                          <Timebase>1/14112000</Timebase>
                      </Audio>
                      <Audio>
                          <Bitrate>128.000000</Bitrate>
                          <Channel>2</Channel>
                          <ChannelLayout>stereo</ChannelLayout>
                          <CodecLongName>MP3 (MPEG audio layer 3)</CodecLongName>
                          <CodecName>mp3</CodecName>
                          <CodecTag>0x0000</CodecTag>
                          <CodecTagString>[0][0][0][0]</CodecTagString>
                          <CodecTimeBase>1/14112000</CodecTimeBase>
                          <Duration>13.688163</Duration>
                          <Index>0</Index>
                          <SampleFmt>fltp</SampleFmt>
                          <SampleRate>44100</SampleRate>
                          <StartTime>0.025057</StartTime>
                          <Timebase>1/14112000</Timebase>
                      </Audio>
                      <Subtitle/>
                      <Video/>
                  </Stream>
              </MediaInfo>
              <MediaResult>
                  <OutputFile>
                      <Bucket>test-123456789</Bucket>
                      <Md5Info>
                          <Md5>3b883c0462ba845acdf3eb7e30db1a1c</Md5>
                          <ObjectName>output/audio.mp3</ObjectName>
                      </Md5Info>
                      <Md5Info>
                          <Md5>62de6bb513d6105eeeb1a6ab0077cb5a</Md5>
                          <ObjectName>output/backgroud.mp3</ObjectName>
                      </Md5Info>
                      <ObjectName>output/audio.mp3</ObjectName>
                      <ObjectName>output/backgroud.mp3</ObjectName>
                      <ObjectPrefix/>
                      <Region>ap-chongqing</Region>
                  </OutputFile>
              </MediaResult>
              <Output>
                  <AuObject>output/audio.mp3</AuObject>
                  <Bucket>test-123456789</Bucket>
                  <Object>output/backgroud.mp3</Object>
                  <Region>ap-chongqing</Region>
              </Output>
              <UserData>This is my VoiceSeparate job.</UserData>
              <TemplateId>t1f6ac18da8bdc403fa27ac4ffnd7a6sa1</TemplateId>
              <TemplateName>videoseparate_12654</TemplateName>
          </Operation>
          <QueueId>p2242ab62c7c94486915508540933a2c6</QueueId>
          <StartTime>2022-07-01T10:12:27+0800</StartTime>
          <State>Success</State>
          <Tag>VoiceSeparate</Tag>
          <Workflow>
              <Name>VoiceSeparate_1581665960537</Name>
              <RunId>ic90edd59f84f11ec9d4f525400a3c59f</RunId>
              <WorkflowId>web6ac56c1ef54dbfa44d7f4103203be9</WorkflowId>
              <WorkflowName>workflow-test</WorkflowName>
          </Workflow>
      </JobsDetail>
    </Response>
    

    案例 3:通过工作流触发的任务回调, 格式为 JSON

    {
      "EventName": "TaskFinish",
      "JobsDetail": {
          "Code": "Success",
          "CreationTime": "2022-07-01T10:12:26+0800",
          "EndTime": "2022-07-01T10:12:32+0800",
          "Input": {
              "BucketId": "test-123456789",
              "Object": "input/demo.mp3",
              "Region": "ap-chongqing",
              "CosHeaders": [{
                      "Key": "Content-Type",
                      "Value": "video/mp3"
                  },
                  {
                      "Key": "x-cos-request-id",
                      "Value": "NjJiZDYwYTFfNjUzYTYyNjRfZjEwZl8xMmZhYzY5"
                  },
                  {
                      "Key": "EventName",
                      "Value": "cos:ObjectCreated:Put"
                  },
                  {
                      "Key": "Size",
                      "Value": "1326515"
                  }
              ]
          },
          "JobId": "j40644e92f8e311ecb90d0b03267ce0e5",
          "Operation": {
              "MediaInfo": {
                  "Format": {
                      "Bitrate": "128.147000",
                      "Duration": "13.688163",
                      "FormatLongName": "MP2/3 (MPEG audio layer 2/3)",
                      "FormatName": "mp3",
                      "NumProgram": "0",
                      "NumStream": "1",
                      "Size": "219263",
                      "StartTime": "0.025057"
                  },
                  "Stream": {
                      "Audio": [{
                              "Bitrate": "128.000000",
                              "Channel": "2",
                              "ChannelLayout": "stereo",
                              "CodecLongName": "MP3 (MPEG audio layer 3)",
                              "CodecName": "mp3",
                              "CodecTag": "0x0000",
                              "CodecTagString": "[0][0][0][0]",
                              "CodecTimeBase": "1/14112000",
                              "Duration": "13.688163",
                              "Index": "0",
                              "SampleFmt": "fltp",
                              "SampleRate": "44100",
                              "StartTime": "0.025057",
                              "Timebase": "1/14112000"
                          },
                          {
                              "Bitrate": "128.000000",
                              "Channel": "2",
                              "ChannelLayout": "stereo",
                              "CodecLongName": "MP3 (MPEG audio layer 3)",
                              "CodecName": "mp3",
                              "CodecTag": "0x0000",
                              "CodecTagString": "[0][0][0][0]",
                              "CodecTimeBase": "1/14112000",
                              "Duration": "13.688163",
                              "Index": "0",
                              "SampleFmt": "fltp",
                              "SampleRate": "44100",
                              "StartTime": "0.025057",
                              "Timebase": "1/14112000"
                          }
                      ]
                  }
              },
              "MediaResult": {
                  "OutputFile": {
                      "Bucket": "test-123456789",
                      "Md5Info": [{
                              "Md5": "3b883c0462ba845acdf3eb7e30db1a1c",
                              "ObjectName": "output/audio.mp3"
                          },
                          {
                              "Md5": "62de6bb513d6105eeeb1a6ab0077cb5a",
                              "ObjectName": "output/backgroud.mp3"
                          }
                      ],
                      "ObjectName": [
                          "output/audio.mp3",
                          "output/backgroud.mp3"
                      ],
                      "Region": "ap-chongqing"
                  }
              },
              "Output": {
                  "AuObject": "output/audio.mp3",
                  "Bucket": "test-123456789",
                  "Object": "output/backgroud.mp3",
                  "Region": "ap-chongqing"
              },
              "UserData": "This is my VoiceSeparate job.",
              "TemplateId": "t1f6ac18da8bdc403fa27ac4ffnd7a6sa1",
              "TemplateName": "videoseparate_12654"
          },
          "QueueId": "p2242ab62c7c94486915508540933a2c6",
          "StartTime": "2022-07-01T10:12:27+0800",
          "State": "Success",
          "Tag": "VoiceSeparate",
          "Workflow": {
              "Name": "VoiceSeparate_1581665960537",
              "RunId": "ic90edd59f84f11ec9d4f525400a3c59f",
              "WorkflowId": "web6ac56c1ef54dbfa44d7f4103203be9",
              "WorkflowName": "workflow-test"
          }
      }
    }
    
    联系我们

    联系我们,为您的业务提供专属服务。

    技术支持

    如果你想寻求进一步的帮助,通过工单与我们进行联络。我们提供7x24的工单服务。

    7x24 电话支持