All Products
Search
Document Center

ApsaraVideo Media Processing:FAQs about transcoding output file

Last Updated:Dec 05, 2018

How to get the name/URL of the transcoded file?

Scenario

When you upload the original video, and the workflow is triggered to perform the transcoding task, how can you get the URL of the transcoded file?

Solution

  • Get the name/URL of the transcoded file according to naming rules

    Log on to the Media Processing console > Library > Library Settings > Workflows, select the desired workflow, and click View at the right side. Hover the mouse on the Transcode/Screenshot and other modules, you can see the corresponding Output Location of the output bucket. The name of the corresponding output file is the output location. You can replace the custom variable to a specific value. The corresponding URL is Bucketname.Endpoint/Output Location.suffix.

    1

    Note:

    • In the output Object, you can set the static constant and variable. The static constant can be edited directly, and the variable can only be quoted for use by using brace ({}). The selectable variables in the output Object are as follows:

    • {RunId}: the workflow running ID,

    • {ObjectPrefix}: the location of the original file, not including the Bucket information,

    • {FileName}: the name of the original file, not including the extension,

    • {ExtName}: the extension of the original file,

    • For more information about the meaning of Endpoint, see Endpoint settings.

  • Get the name/URL of the transcoded file from the MPS console

    Log on to the Media Processing console > Library > Media files, select the desired video, and click Manage > Retrieve Media URL > TRANSCODE > Copy, and you can get the name/URL of the transcoded file.

    2

  • Get the name/URL of the transcoded file by using code program

    Set the MNS queue or Notification of the MNS in the workflow (For more information, see Get the notification instance of workflow.) > get the consumption message corresponding to the business end > When you get the “Report” message of the corresponding workflow instance, the transcoding task ends > call the transcoding API interface according to the URL of the input Object or the Media ID(MediaId). For more information about the interface, see QueryMediaListByURL and QueryMediaList.

    Java code example of transcoding result query based on input Object URL:

    1. static QueryMediaListByURLResponse queryMediaListByURL(DefaultAcsClient client) {
    2. QueryMediaListByURLRequest request = new QueryMediaListByURLRequest();
    3. request.setFileURLs(objecturl);
    4. request.setIncludePlayList(true);
    5. QueryMediaListByURLResponse response = null;
    6. try {
    7. response = client.getAcsResponse(request);
    8. } catch (ServerException e) {
    9. throw new RuntimeException("QueryMediaListByURLRequest Server failed");
    10. } catch (ClientException e) {
    11. throw new RuntimeException("QueryMediaListByURLRequest Client failed");
    12. }
    13. return response;
    14. }

    Java code example of transcoding result query based on input media ID:

    1. static QueryMediaListResponse QueryMediaList(DefaultAcsClient client) {
    2. QueryMediaListRequest request = new QueryMediaListRequest();
    3. request.setMediaIds("media ID");
    4. request.setIncludePlayList(true);
    5. QueryMediaListResponse response = null;
    6. try {
    7. response = client.getAcsResponse(request);
    8. } catch (ServerException e) {
    9. throw new RuntimeException("QueryMediaListRequest Server failed");
    10. } catch (ClientException e) {
    11. throw new RuntimeException("QueryMediaListRequest Client failed");
    12. }
    13. return response;
    14. }

Why isn’t the CDN address provided in the output file after the workflow running?

Scenario

After you upload the video and the workflow is triggered to perform the transcoding task, on the MPS console > Library > Media Files > Manage > Retrieve Media URL > Media URL, the corresponding CDN address is not displayed.

2

Solution

After editing or deleting corresponding workflow, reset the workflow and add CDN domain name in Configure workflow > Configure Content Delivery Network (CDN). In the newly created transcoding task under the workflow, the newly added CDN domain name is displayed in the URL of the output file.

2

Cause

Only when you add a CDN domain name while creating a workflow, is the CDN URL displayed in the output file after transcoding. If the CDN domain name does not exist when you create the workflow, then you bind the CDN domain name with the bucket for acceleration, this domain name is not diaplayed in the Media URL.

Attentions

In Source File > Media File, you cannot get the CDN URL. You must bind the bucket first or use code to replace the bucket domain name with the corresponding CDN domain name.

2

Output file supports the following variables setting

In output Object, you can select the floowing variables:

  • {RunId}: workflow running ID

  • {ObjectPrefix}: location of the original file (Input file), not including Bucket information

  • {FileName}: name of the original file (Input file), not including extension

  • {ExtName}: the extension of the original file (Input file)

How to trigger the workflow running?

When a video file is input in the Input Bucket during setting workflow, the corresponding workflow is triggered to perform the transcoding or screenshot tasks.

3

For more information about how to upload video file to the Input Bucket of the workflow, see Methods of uploading video files.