All Products
Search
Document Center

ApsaraVideo VOD:CreateUploadVideo

更新時間:Dec 19, 2024

Obtains an upload URL and an upload credential for uploading an audio or video file and generates the audio or video ID. ApsaraVideo VOD issues upload URLs and credentials to perform authorization and ensure security. This prevents unauthorized users from uploading media files. ApsaraVideo VOD generates media IDs, video IDs, and image IDs together with upload URLs and credentials. Media IDs are used in lifecycle management and media processing.

Operation description

  • Make sure that you understand the billing method and prices of ApsaraVideo VOD before you call this operation. You are charged storage fees after you upload media files to ApsaraVideo VOD. For more information, see Billing of media asset storage. If you have activated the acceleration service, you are charged acceleration fees when you upload media files to ApsaraVideo VOD. For more information, see Billing of acceleration traffic.
  • You can call this operation to obtain upload URLs and credentials for video and audio files. For more information, see Upload URLs and credentials.
  • You can call this operation only to obtain the upload URLs and credentials for media files and create media assets in ApsaraVideo VOD. You cannot call this operation to upload media files. For more information about how to upload media files by calling API operations, see Upload media files by calling API operations.
  • If the upload credential expires, call the RefreshUploadVideo operation to obtain a new upload credential. The default validity period of an upload credential is 3,000 seconds.
  • You can configure a callback to receive an event notification when an audio or video file is uploaded. Alternatively, after you upload an audio or video file, you can call the GetMezzanineInfo operation to determine whether the upload is successful. For more information, see Overview .
  • The value of the VideoId parameter that is returned after you call this operation can be used for media processing or the lifecycle management of media assets.
  • You must obtain a URL and a credential before you upload a media file to ApsaraVideo VOD. ApsaraVideo VOD supports multiple upload methods. Each method has different requirements on upload URLs and credentials. For more information, see Upload URLs and credentials.

Debugging

You can run this interface directly in OpenAPI Explorer, saving you the trouble of calculating signatures. After running successfully, OpenAPI Explorer can automatically generate SDK code samples.

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:CreateUploadVideocreate
*All Resources
*
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
CoverURLstringNo

The URL of the custom video thumbnail.

https://example.aliyundoc.com/image/D22F553TEST****.jpeg
DescriptionstringNo

The description of the audio or video file.

  • The value can be up to 1,024 characters in length.
  • The value must be encoded in UTF-8.
UploadTest
FileNamestringYes

The name of the source file.

  • The name must contain a file name extension, which is not case-sensitive.
  • For more information about file name extensions supported by ApsaraVideo VOD, see Overview .
D:\video_01.mp4
FileSizelongNo

The size of the source file. Unit: bytes.

123
TitlestringYes

The title of the audio or video file.

  • The title can be up to 128 characters in length.
  • The value must be encoded in UTF-8.
UploadTest
CateIdlongNo

The ID of the category. You can use one of the following methods to obtain the ID:

  • Log on to the ApsaraVideo VOD console. In the left-side navigation pane, choose Configuration Management > Media Management > Categories to view the category ID of the media file.
  • Obtain the value of CateId from the response to the AddCategory operation.
  • Obtain the value of CateId from the response to the GetCategories operation.
100036****
TagsstringNo

The tags of the audio or video file.

  • You can specify a maximum of 16 tags.
  • If you want to specify multiple tags, separate the tags with commas (,).
  • Each tag can be up to 32 characters in length.
  • The value must be encoded in UTF-8.
tag1,tag2
UserDatastringNo

The custom configurations such as callback configurations and upload acceleration configurations. The value must be a JSON string. For more information, see Request parameters.

Note
  • The callback configurations take effect only after you specify the HTTP callback URL and select specific callback events in the ApsaraVideo VOD console. For more information about how to configure HTTP callback settings in the ApsaraVideo VOD console, see Configure callback settings.
  • If you want to enable the upload acceleration feature, submit a request on Yida. For more information, see Overview .
  • {"MessageCallback":{"CallbackURL":"http://example.aliyundoc.com"},"Extend":{"localId":"*****","test":"www"}}
    TemplateGroupIdstringNo

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

    • 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.************
    • Obtain the value of the TranscodeTemplateGroupId parameter from the response to the AddTranscodeTemplateGroup operation that you called to create a transcoding template group.
    • Obtain the value of the TranscodeTemplateGroupId parameter from the response to the ListTranscodeTemplateGroup operation that you called to query transcoding template groups.
    Note
  • If you specify both WorkflowId and TemplateGroupId, the value of the WorkflowId parameter takes effect.
  • If this parameter is not specified, transcoding is performed based on the default transcoding template group. If the transcoding template group ID is specified, transcoding is performed based on the specified template group.
  • If the No Transcoding template group is used, only the FileUploadComplete event notification is returned after a video is uploaded. The StreamTranscodeComplete event notification is not returned.
  • If you use the No Transcoding template group to upload videos, only videos in the format of MP4, FLV, MP3, M3U8, or WebM can be played. Videos in other formats can only be stored in ApsaraVideo VOD. You can view the file name extension to obtain the video format. If you want to use ApsaraVideo Player, make sure that the version of the player is V3.1.0 or later.
  • 405477f9e214d19ea2c7c854****
    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.

    Note If you specify the WorkflowId and TemplateGroupId parameters, the value of the WorkflowId parameter takes effect. For more information, see Workflows .
    613efff3887ec34af685714cc461****
    StorageLocationstringNo

    The storage address. Perform the following operations to obtain the storage address: Log on to the ApsaraVideo VOD console. In the left-side navigation pane, choose Configuration Management > Media Management > Storage. On the Storage page, view the storage address.

    Note If you leave this parameter empty, audio and video files are uploaded to the default storage address. If you specify a storage address, audio and video files are uploaded to the specified address.
    out-****.oss-cn-shanghai.aliyuncs.com
    AppIdstringNo

    The ID of the application. Default value: app-1000000. For more information, see Overview .

    app-1000000
    Note
  • If you use the No Transcoding template group to upload videos, only videos in the format of MP4, FLV, MP3, M3U8, or WebM can be played. Videos in other formats can only be stored in ApsaraVideo VOD. You can view the file name extension to obtain the video format. If you want to use ApsaraVideo Player, make sure that the version of the player is V3.1.0 or later.
  • If the No Transcoding template group is used, only the FileUploadComplete event notification is returned after a video is uploaded. The StreamTranscodeComplete event notification is not returned.
  • Response parameters

    ParameterTypeDescriptionExample
    object

    The returned result.

    RequestIdstring

    The ID of the request.

    25818875-5F78-4AF6-04D5-D7393642****
    UploadAddressstring

    The upload URL.

    Note The returned upload URL is a Base64-encoded URL. You must decode the Base64-encoded URL before you use an SDK or call an API operation to upload media files. You need to parse UploadAddress only if you use the Object Storage Service (OSS) SDK or call an OSS API operation to upload media files.
    eyJTZWN1cml0a2VuIjoiQ0FJU3p3TjF****
    VideoIdstring

    The ID of the audio or video file. VideoId can be used as a request parameter when you call an operation for media asset management, media processing, or media review.

    93ab850b4f6f54b6e91d24d81d44****
    UploadAuthstring

    The upload credential.

    Note The returned upload credential is a Base64-encoded value. You must decode the Base64-encoded credential before you use an SDK or call an API operation to upload media files. You need to parse UploadAuth only if you use the OSS SDK or call an OSS API operation to upload media files.
    eyJFbmRwb2ludCI6Imm****

    Examples

    Sample success responses

    JSONformat

    {
      "RequestId": "25818875-5F78-4AF6-04D5-D7393642****",
      "UploadAddress": "eyJTZWN1cml0a2VuIjoiQ0FJU3p3TjF****",
      "VideoId": "93ab850b4f6f54b6e91d24d81d44****",
      "UploadAuth": "eyJFbmRwb2ludCI6Imm****"
    }

    Error codes

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

    Change history

    Change timeSummary of changesOperation
    No change history

    Common errors

    The following table describes the error codes that this operation can return.

    Error codeError messageHTTP status codeDescription
    InvalidFileName.ExtensionThe specified FileName’s extension is illegal.400The error message returned because the file name extension in the FileName parameter is invalid. For more information about file name extensions supported in ApsaraVideo VOD, see Overview .
    IllegalCharactersThe specified $Parameter contains illegal emoticon or special characters.400The error message returned because the value of a request parameter such as Title, Description, or Tags contains emoticons.
    LengthExceededMaxThe specified $Parameter length has exceeded $MaxLength bytes.400The error message returned because the value length of a request parameter such as Title, Description, or Tags exceeds the upper limit. For more information about the length limit of parameter values, see the description of the request parameters in this topic.
    TagsExceededMaxThe specified Tags count has exceeded 16.400The error message returned because more than 16 tags were specified for the video.
    InvalidTemplateGroupId.NotFoundThe TemplateGroupId does not exist.404The error message returned because the specified template group ID does not exist.
    InvalidStorage.NotFoundThe StorageLocation does not exist.404The error message returned because the specified storage address does not exist. Log on to the ApsaraVideo VOD console. Choose Configuration Management > Media Management > Storage. On the Storage page, check whether the storage address exists.
    Forbidden.InitFailedInitialization of your account has failed while opening service.403The error message returned because your account failed to be initialized when the service was activated.
    AddVideoFailedAdding video has failed due to some unknown error.503The error message returned because the video ID failed to be generated. Try again later.