All Products
Search
Document Center

ApsaraVideo VOD:RegisterMedia

Last Updated:Aug 04, 2023

Registers a media file.

Operation Description

After you store an audio or video file in an Object Storage Service (OSS) bucket that is used for ApsaraVideo VOD, you can call the RegisterMedia operation to register the media file. After the media file is registered, you can use the media ID associated with the media file to submit transcoding jobs and snapshot jobs in ApsaraVideo VOD. For more information, see SubmitTranscodeJobs and SubmitSnapshotJob.

Note
  • You can register up to 10 OSS media files that have the same storage location at a time.
  • If you use the ApsaraVideo VOD console to upload a media file and do not specify a transcoding template group ID, ApsaraVideo VOD uses the default transcoding template group to transcode the media file. However, if you do not specify a transcoding template group ID when you call the RegisterMedia operation, ApsaraVideo VOD does not automatically transcode the media file after the media file is registered. If you specify a transcoding template group ID, ApsaraVideo VOD uses the specified transcoding template group to transcode the media file.
  • If the media file that you want to register is registered before, this operation returns only the unique media ID that is associated with the media file. No further processing is performed.
  • Authorization information

    The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:

    • Operation: the value that you can use in the Action element to specify the operation on a resource.
    • Access level: the access level of each operation. The levels are read, write, and list.
    • Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
      • The required resource types are displayed in bold characters.
      • If the permissions cannot be granted at the resource level, All Resources is used in the Resource type column of the operation.
    • Condition Key: the condition key that is defined by the cloud service.
    • Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
    OperationAccess levelResource typeCondition keyAssociated operation
    vod:RegisterMediaRead
    • VOD
      acs:vod:*:{#accountId}:*/*
      none
    none

    Request parameters

    ParameterTypeRequiredDescriptionExample
    RegisterMetadatasstringYes

    The metadata of the media file that you want to register. The value is a JSON string. You can specify the metadata for a maximum of 10 media files at a time. For more information about the metadata of media files, see the RegisterMetadata section of this topic.

    [{"FileURL":"https://****.oss-cn-shanghai.aliyuncs.com/video/test/video123.m3u8","Title":"VideoName"}]
    TemplateGroupIdstringNo

    The ID of the transcoding template group. You can use one of the following methods to obtain the ID of the transcoding template group:

    • Log on to the ApsaraVideo VOD console. In the left-side navigation pane, choose Configuration Management > Media Processing > Transcoding Template Groups. On the Transcoding Template Groups page, you can view the ID of the transcoding template group.
    • View the value of the TranscodeTemplateGroupId parameter returned by the AddTranscodeTemplateGroup operation that you called to create a transcoding template group.
    • View the value of the TranscodeTemplateGroupId parameter returned by the ListTranscodeTemplateGroup operation that you called to query a transcoding template group.
    Note
  • If you do not need to transcode the media file, set the TemplateGroupId parameter to VOD_NO_TRANSCODE. Otherwise, an exception occurs during video playback. If you need to transcode the media file, specify the ID of the transcoding template group.
  • If both the WorkflowId and TemplateGroupId parameters are set, the value of the WorkflowId parameter takes effect. For more information, see Workflows.
  • ca3a8f6e49c87b65806709586****
    UserDatastringNo

    The custom configurations such as callback configurations. The value is a JSON string. For more information, see the "UserData: specifies the custom configurations for media upload" section of the Request parameters topic.

    {"Extend":{"localId":"****","test":"www"}}
    WorkflowIdstringNo

    The ID of the workflow. To view the ID of the workflow, log on to the ApsaraVideo VOD console. In the left-side navigation pane, choose Configuration Management > Media Processing > Workflows.

    NoteIf both the WorkflowId and TemplateGroupId parameters are set, the value of the WorkflowId parameter takes effect. For more information, see Workflows.
    637adc2b7ba51a83d841606f8****

    RegisterMetadata

    The following table describes the metadata of the media file that you want to register.

    ParameterTypeRequiredDescription
    FileURLStringYesThe OSS URL of the source file. You can call the GetMezzanineInfo operation to obtain the OSS URL of the source file.
    The URL can be up to 1,024 bytes in length. The file name must be globally unique. If the media file that you want to register is registered before, the unique media ID that is associated with the media file is returned.
    TitleStringYesThe title of the media file. The title can be up to 128 bytes in length. The value must be encoded in UTF-8.
    DescriptionStringNoThe description of the media file. The description can be up to 1,024 bytes in length. The value must be encoded in UTF-8.
    TagsStringNoThe one or more tags of the media file. Each tag can be up to 32 bytes in length. You can specify a maximum of 16 tags. Separate multiple tags with commas (,). The value must be encoded in UTF-8.
    CoverURLStringNoThe URL of the thumbnail. The URL can be up to 1,024 bytes in length.
    CateIdLongNoThe category ID of the media file. You can use one of the following methods to obtain the category ID:
    Log on to the ApsaraVideo VOD console. In the left-side navigation pane, choose Configuration Management > Media Management > Categories. On the Categories page, you can view the category ID of the media file.
    View the value of the CateId parameter returned by the AddCategory operation that you called to create a category.
    View the value of the CateId parameter returned by the GetCategories operation that you called to query a category.

    Response parameters

    ParameterTypeDescriptionExample
    object

    The response parameters.

    RequestIdstring

    The ID of the request.

    14F43C5C-8033-448B-AD04F64E5098****
    FailedFileURLsarray

    The URLs of the media files that failed to be registered.

    string

    The URLs of the media files that failed to be registered.

    ["http://****.oss-cn-shanghai.aliyuncs.com/vod_sample_03.mp4"]
    RegisteredMediaListobject []

    The media files that are registered, including newly registered and repeatedly registered media files.

    NewRegisterboolean

    Indicates whether the media file is newly registered or repeatedly registered. Valid values:

    • true: The media file is newly registered.
    • false: The media file is repeatedly registered.
    false
    FileURLstring

    The OSS URL of the media file.

    http://****.oss-cn-shanghai.aliyuncs.com/vod_sample_01.mp4
    MediaIdstring

    The ID of the media file that is registered with ApsaraVideo VOD. If the registered media file is an audio or video file, the value of the VideoId parameter returned by ApsaraVideo VOD takes effect.

    d97af32828084d1896683b1aa38****

    Examples

    Sample success responses

    JSONformat

    {
      "RequestId": "14F43C5C-8033-448B-AD04F64E5098****",
      "FailedFileURLs": [
        "[\"http://****.oss-cn-shanghai.aliyuncs.com/vod_sample_03.mp4\"]"
      ],
      "RegisteredMediaList": [
        {
          "NewRegister": false,
          "FileURL": "http://****.oss-cn-shanghai.aliyuncs.com/vod_sample_01.mp4",
          "MediaId": "d97af32828084d1896683b1aa38****"
        }
      ]
    }

    Error codes

    For a list of error codes, visit the Service error codes.