Creating a Video Topics Segmentation Job

Function

Create a video topics segmentation job to improve the efficiency of video recognition, editing, and retrieval by quickly and accurately segmenting a long video into segments of different topics.

  • Supported video formats: AVI, WMV, MPG, MPEG, MP4, MOV, M4V, MKV
  • Videos cannot be stored in OBS buckets encrypted by KMS.
  • The size of a single video cannot exceed 4 GB.
  • When data is read from a specified URL, the video size cannot exceed 1 GB.
  • This subservice only applies to standard news videos with news anchors identified.
  • A face can only be identified if the facial image includes at least 60 pixels.
  • Faces of news anchors must be in the valid area (excluding the 10% edge area).
  • A news anchor can be identified only when the front face of the news anchor appears for at least three times and retain on the image consistently for at least 2 seconds each time.
  • A maximum of 3 news anchors can be identified simultaneously.
  • Supported regions: CN North-Beijing1 and CN North-Beijing4.

URI

  • URI format:
    POST /v2/{project_id}/services/video-topic-segmentation-svc/tasks
  • Parameters

    Parameter

    Mandatory

    Type

    Description

    project_id

    Yes

    String

    Project ID corresponding to the region where the service is located. For details about how to obtain the project ID, see Obtaining the Project ID.

Request Parameters

  • Example request 1 (input type: url; output type: obs)
    POST /v2/{project_id}/services/video-topic-segmentation-svc/task
    {
     "name": "url-obs",
     "input": {
      "type": "url",
      "data": [{
       "url": "https://obs-vcm.obs.cn-north-1.myhwclouds.com/videos/est_h264.mp4"
      }]
     },
     "output": {
      "obs": {
       "bucket": "obs-zuubo",
       "path": "out_put/"
      }
     },
     "service_version": "1.0"
      }
  • Example request 2 (input type: url; output type: hosting)
    POST /v2/{project_id}/services/video-topic-segmentation-svc/tasks
    {
     "name": "url-hosting",
     "input": {
      "type": "url",
      "data": [{
       "url": "https://obs-vcm.obs.cn-north-1.myhwclouds.com/videos/est_h264.mp4"
      }]
     },
     "output": {
      "hosting": {}
     },
     "service_version": "1.0"
    }
  • Example request 3 (input type: obs; output type: obs)
    POST /v2/{project_id}/services/video-topic-segmentation-svc/tasks
    {
        "name": "obs-obs",
        "description": "description",
        "input": {
               "type": "obs",
               "data": [
                      {
                             "bucket": "obs-iva",
                             "path": "input/demo.mp4"
                      }
               ]
        },
        "output": {
               "obs": {
                      "bucket": "obs-iva",
                      "path": "output/"
               }
     },
       "service_version":"1.0"
      }
  • Example request 4 (input type: obs; output type: hosting)
    POST /v2/{project_id}/services/video-topic-segmentation-svc/tasks
    {
     "name": "obs-hosting",
     "input": {
      "type": "obs",
      "data": [{
       "bucket": "obs-henayou",
       "path": "inputs/201807271900.mp4"
              }]
     },
     "output": {
      "hosting": {}
     },
     "service_version": "1.0"
    }
  • Parameters

    Parameter

    Mandatory

    Type

    Description

    name

    Yes

    String

    Job name, which consists of 1 to 100 characters, including letters (A to Z and a to z), digits (0 to 9), hyphens (-), and underscores (_).

    description

    No

    String

    Job description, which consists of a maximum of 500 characters.

    input

    Yes

    Object

    List of input video data. Currently, only the following input types are supported:
    • obs: Read video data from OBS on HUAWEI CLOUD. The video size cannot exceed 4 GB. Videos encrypted by KMS cannot be stored in OBS buckets.
    • url: Read video data from a specified URL. The video size cannot exceed 1 GB. Currently, only the URL of OBS is supported. You need to grant the anonymous users the permission to read the URL. For details, see Bucket ACL Overview.

    For details, see task.input.

    service_version

    Yes

    String

    Version, which is set to 1.0.

    output

    Yes

    Object

    List of output result data. Currently, only the following output types are supported:
    • obs: Export the results to the OBS bucket you specified.
    • hosting: Host the results on OBS at the service side. The OBS path is specified by the service. You can obtain the path by using the API that queries a single task. For details, see Querying a Single Job.

    For details, see task.output.

Response Parameters

  • Example response
    [
      { 
        "id": "f18320e61e4c4dc685aa2dfc22a28dc5"
      }
    ]
  • Job ID description

    Parameter

    Type

    Description

    id

    String

    Job ID

Video Topics Segmentation Results

The video topics segmentation results are saved in JSON format in the output path you specified.

  • Example result file
    {
        "fps":25,
        "results":[
                 {
                    "frame":467,
                    "time":"00:00:18:17"
                 },
                 {
                    "frame":1374,
                    "time":"00:00:54:24"
                 }
            ]
    }
  • Field description

    Field

    Description

    fps

    Video frame rate

    results

    Array of the segmentation results

    frame

    Frame number of the split point

    time

    Time of the split point

Status Codes

  • Normal

    201

  • Abnormal

    Status Code

    Description

    400 Bad Request

    Request error. For details about the returned error code, see Error Codes.

    401 Unauthorized

    Authentication failed.

    403 Forbidden

    No operation permission.

    404 Not Found

    The requested resource was not found.

    500 Internal Server Error

    Internal service error.

    503 Service Unavailable

    Service unavailable.