Updated on 2024-12-04 GMT+08:00

Dumps media assets to OBS

Function

If you have stored audio/video files in an OBS bucket before using VOD, you can call this API to dump the files to VOD and manage them on VOD.

Before using this API, perform the following operations:

  • Authorize the user to use VOD. For details, see section "Creating a User and Granting VOD Permissions" in the VOD User Guide.

  • Authorize the user to use OBS. For details, see section "Creating an IAM User and Granting OBS Permissions" in the OBS User Guide.

  • Before calling this API, you need to call the API for Authorizing Access to OBS to authorize VOD to access the OBS bucket where the audio/video files are stored.

Constraints

Cloud services in different regions cannot be interconnected. As a result, the OBS bucket where audio/video files are stored and the VOD service must be in the same region. For example, audio/video files stored in OBS buckets of CN North-Beijing4 can be dumped only to VOD of CN North-Beijing4.

URI

POST /v1.0/{project_id}/asset/reproduction

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID. For details about how to obtain the project ID, see Obtaining a Project ID.

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

No

String

User token. This parameter is mandatory when token authentication is used.

It can be obtained by calling the IAM API used to obtain a user token. The value of X-Subject-Token in the response header is a token.

Authorization

No

String

Authentication information. This parameter is mandatory for AK/SK authentication.

X-Sdk-Date

No

String

Time when the request is sent. This parameter is mandatory for AK/SK authentication.

Table 3 Request body parameters

Parameter

Mandatory

Type

Description

video_type

Yes

String

Dumped audio/video file format.

The options are as follows:

  • Video files: MP4, TS, MOV, MXF, MPG, FLV, WMV, AVI, M4V, F4V, MPEG, 3GP, ASF, MKV, HLS, RMVB and WebM

  • Audio files: MP3, OGG, WAV, WMA, APE, FLAC, AAC, AC3, MMF, AMR, M4A, M4R, WV, and MP2

If an audio file is uploaded, transcoding, watermarking, and subtitling are not supported.

NOTE:

When video_type is set to HLS, storage_mode must be set to storage in a tenant bucket, and the output path and input path must be in the same directory.

title

Yes

String

Media asset title. The value is UTF-8-encoded and contains a maximum of 128 characters.

description

No

String

Video description. The value contains a maximum of 1024 characters.

category_id

No

Integer

Media file category ID

You can call the API for Creating a Media File Category to create a media file category, or create a media file category in the category settings on the VOD console and obtain the category ID.

NOTE:

If this parameter is not specified or is set to -1, the uploaded audio/video files fall into the preconfigured Other category.

tags

No

String

Video tag.

Each tag contains up to 24 characters and up to 16 tags are allowed.

Use commas (,) to separate tags, which are UTF-8-encoded.

auto_publish

No

Integer

Whether to publish the content automatically.

The options are as follows:

  • 0: The content is not automatically published.

  • 1: The content is automatically published.

Default value: 1

template_group_name

No

String

Name of a transcoding template group

If this parameter is specified, the specified transcoding template is used to transcode the uploaded audio/video. You can configure a transcoding template on the VOD console. For details, see Transcoding Settings in VOD User Guide.

NOTE:

If both template_group_name and workflow_name are specified, template_group_name takes effect.

auto_encrypt

No

Integer

Whether to automatically encrypt a file

Possible values are:

  • 0: not encrypted

  • 1: encrypted

Default value: 0

If encryption is required, a transcoding template must be configured and the transcoded file must be in HLS format.

auto_preheat

No

Integer

Whether to automatically pre-load content to the CDN

Possible values are:

  • 0: The content is not automatically pre-loaded.

  • 1: The content is automatically pre-loaded.

Default value: 0

thumbnail

No

Thumbnail object

Snapshot parameters

review

No

Review object

Media asset review parameter.

NOTE:

[Only VOD in CN North-Beijing1 and CN North-Beijing4 supports this function.] (tag:hws)

[Only VOD in AP-Singapore supports this function.] (tag:hws_hk)

workflow_name

No

String

Workflow nameIf this parameter is specified, the specified workflow is used to transcode the uploaded audio/video. You can configure a workflow on the VOD console. For details, see Transcoding Settings in VOD User Guide.

input

Yes

File_addr object

Media asset storage parameters.

storage_mode

No

Integer

Storage mode

Possible values are:

  • 0: Videos are copied to a VOD bucket.

  • 1: Videos are stored in a tenant bucket.

Default value: 0

output_bucket

No

String

Output bucket name. This parameter is mandatory when storage_mode is set to 1.

output_path

No

String

Output path name. This parameter is mandatory when storage_mode is set to 1.

Table 4 Thumbnail

Parameter

Mandatory

Type

Description

type

Yes

String

Snapshot capturing mode.

The options are as follows:

  • time: Snapshots are captured by interval.

  • dots: Snapshots are captured at a specified time point.

  • quantity: Snapshots are captured based on the specified quantity and video duration.

quantity

No

Integer

This parameter is mandatory when type is set to quantity. Snapshots are captured based on the specified quantity and video duration.

Value range: an integer between 1 and 10

quantity_time

No

Integer

This parameter is optional when type is set to quantity. Snapshots are captured based on the specified quantity at a specified interval.

Value range: an integer between 0 and 2,147,483,647

time

No

Integer

Interval for sampling, in seconds.

type is set to time.

Default value: 12

Value range: an integer between 0 and 100

dots

No

Array of integers

This parameter is mandatory when type is set to dots. The array of time points when a snapshot is captured is used.

cover_position

No

Integer

The value indicates which snapshot is specified as the thumbnail.

The default value is 1.

format

No

Integer

Snapshot file format

Possible values are:

  • 1: jpg

The default value is 1.

aspect_ratio

No

Integer

Aspect ratio

Possible values are:

  • 0: adaptive (the original aspect ratio is retained)

  • 1: 16:9

Default value: 0

max_length

No

Integer

The longest side of a snapshot.

Unit: pixel

The width of the snapshot is scaled proportionally with the longest side and input video pixel.

Default value: 480

Table 5 Review

Parameter

Mandatory

Type

Description

template_id

Yes

String

Review template ID. You can obtain the value after configuring the review template on the VOD console. For details, see Review Settings in VOD User Guide.

NOTE:

[Only VOD in CN North-Beijing1 and CN North-Beijing4 supports this function.] (tag:hws)

[Only VOD in AP-Singapore supports this function.] (tag:hws_hk)

interval

No

Integer

Snapshot check interval. The value range is [0,100]. This parameter is ignored in request parameters.

politics

No

Integer

Confidence of politically sensitive content detection. The value range is [0,100]. This parameter is ignored in request parameters.

A higher confidence level indicates a more reliable review result. If this function is disabled or the value is set to 0, this check is not performed.

terrorism

No

Integer

Confidence of terrorism-related content detection. The value range is [0,100]. This parameter is ignored in request parameters.

A higher confidence level indicates a more reliable review result. If this function is disabled or the value is set to 0, this check is not performed.

porn

No

Integer

Confidence of pornographic content detection. The value range is [0,100]. This parameter is ignored in request parameters.

A higher confidence level indicates a more reliable review result. If this function is disabled or the value is set to 0, this check is not performed.

Table 6 File_addr

Parameter

Mandatory

Type

Description

bucket

Yes

String

OBS bucket name

location

Yes

String

Name of the region where the bucket is located. For example, the region name of CN North-Beijing4 is cn-north-4. The created bucket must be in the region of the VOD service.

object

Yes

String

File path

Response Parameters

Status code: 200

Table 7 Response body parameters

Parameter

Type

Description

asset_id

String

Media asset ID assigned by VOD. This parameter can only be queried but cannot be modified.

Status code: 400

Table 8 Response body parameters

Parameter

Type

Description

error_code

String

Error code

error_msg

String

Error description

Example Requests

  • Dumps HLS videos stored in OBS buckets to VOD (TS files and M3U8 files must be in the same directory).

    POST https://{endpoint}/v1.0/{project_id}/asset/reproduction
    
    Content-Type: application/json
    {
      "video_type": "HLS",
      "title": "tittle",
      "auto_publish": 1,
      "input": {
        "bucket": "bucket_name",
        "location": "cn-north-4",
        "object": "test/hls/test_video.m3u8"
      },
      "storage_mode": 1,
      "output_bucket": "bucket_name",
      "output_path": "test/hls"
    }
  • Dumps media files in OBS buckets to VOD.

    POST https://{endpoint}/v1.0/{project_id}/asset/reproduction
    
    Content-Type: application/json
    {
      "input": {
        "bucket": "bucket",
        "location": "cn-north-4",
        "object": "path"
      },
      "title": "title",
      "description": "des",
      "category_id": -1,
      "tags": "test",
      "video_type": "MP4",
      "auto_publish": 1,
      "template_group_name": "tempName"
    }

Example Responses

Status code: 200

The information is returned when the request succeeds.

{
  "asset_id" : "f488337c31c8e4622f1590735b134c65"
}

Status code: 400

The information is returned when the request fails.

{
  "error_code" : "VOD.10003",
  "error_msg" : "The specified key does not exist."
}

Status Codes

Status Code

Description

200

The information is returned when the request succeeds.

400

The information is returned when the request fails.

Error Codes

See Error Codes.