All Products
Search
Document Center

Object Storage Service:sys/saveas

Last Updated:Dec 26, 2024

This topic describes the concept and usage notes of the sys/saveas parameter and provides examples on how to use the parameter.

What is sys/saveas?

By default, a synchronously processed object is not saved. You must specify the sys/saveas parameter in a request to save the processed object in a specific bucket. Asynchronous processing is used to process objects asynchronously in the form of a task. Only the task ID is returned for a request. Therefore, you must specify the sys/saveas parameter in the request before you send the request. In this case, the processed object is saved in a specific bucket for subsequent access.

Usage notes

  • Required permissions:

    • To save a processed object, you must have the oss:PostProcessTask permission on the source bucket in which the source object is stored and the oss:PutObject permission on the processed object.

    • The access control list (ACL) of a processed object is the same as that of the bucket to which you want to save the object and cannot be changed.

  • Requirements on regions: You can save the processed object to the same bucket in which the source object is stored or to a different bucket. However, the source bucket and the destination bucket must belong to the same Alibaba Cloud account and be located in the same region.

  • Storage method: You cannot directly save objects that are processed by using object URLs to a specific bucket. You can save the processed objects to your local computer and then upload them to the destination bucket.

  • Storage duration of processed objects: If you want to store a processed object for a specific period of time, configure a lifecycle rule for the object to specify the time when the object expires. For more information, see Overview.

Parameter description

If you specify the sys/saveas parameter in a request, you must specify the options that are described in the following table.

Option

Description

o

The name of the processed object. The value of this option must be URL-safe Base64-encoded. For more information, see Encode watermark-related parameters.

Note

The o option supports variables. Variables are in the format of {varname} or a combination of strings and {varname}. For more information, see Variables.

b

The name of the bucket to which you want to save the processed object. The value of this option must be URL-safe Base64-encoded. If this option is not specified, the processed object is saved to the bucket in which the source object is stored.

Note

The b option supports variables. Variables are in the format of {varname} or a combination of strings and {varname}. For more information, see Variables.

Use OSS SDKs

You can specify the sys/saveas parameter in a request to save the object that is processed by using OSS SDKs to a specific bucket. The following sample code provides examples on how to save the object processed by using OSS SDKs for common programming languages. For more information about how to save the object processed by using OSS SDKs for other programming languages, see Overview.

import com.aliyun.oss.*;
import com.aliyun.oss.common.auth.*;
import com.aliyun.oss.common.utils.BinaryUtil;
import com.aliyun.oss.common.utils.IOUtils;
import com.aliyun.oss.model.GenericResult;
import com.aliyun.oss.model.ProcessObjectRequest;
import java.util.Formatter;

public class Demo {
    public static void main(String[] args) throws Throwable {
        // Specify the endpoint of the region. In this example, the endpoint of the China (Hangzhou) region is used. Specify your actual endpoint. 
        String endpoint = "https://oss-cn-hangzhou.aliyuncs.com";
        // We recommend that you do not save access credentials in the project code. Otherwise, access credentials may be leaked, which compromises the security of all resources in your account. In this example, access credentials are obtained from environment variables. Before you run the sample code, make sure that the environment variables are configured. 
        EnvironmentVariableCredentialsProvider credentialsProvider = CredentialsProviderFactory.newEnvironmentVariableCredentialsProvider();
        // Specify the name of the bucket. Example: examplebucket. 
        String bucketName = "examplebucket";
        // Specify the full path of the object that you want to process. Do not include the bucket name in the full path. 
        String sourceImage = "exampleimage.png";

        // Create an OSSClient instance. 
        OSS ossClient = new OSSClientBuilder().build(endpoint, credentialsProvider);

        try {
            // Resize the image to 100 x 100 pixels. 
            StringBuilder sbStyle = new StringBuilder();
            Formatter styleFormatter = new Formatter(sbStyle);
            String styleType = "image/resize,m_fixed,w_100,h_100";
            // Save the processed image as example-resize.png to the current bucket. 
            // Specify the full path of the object that you want to process. Do not include the bucket name in the full path. 
            String targetImage = "example-resize.png";
            styleFormatter.format("%s|sys/saveas,o_%s,b_%s", styleType,
                    BinaryUtil.toBase64String(targetImage.getBytes()),
                    BinaryUtil.toBase64String(bucketName.getBytes()));
            System.out.println(sbStyle.toString());
            ProcessObjectRequest request = new ProcessObjectRequest(bucketName, sourceImage, sbStyle.toString());
            GenericResult processResult = ossClient.processObject(request);
            String json = IOUtils.readStreamAsString(processResult.getResponse().getContent(), "UTF-8");
            processResult.getResponse().getContent().close();
            System.out.println(json);
        } catch (OSSException oe) {
            System.out.println("Caught an OSSException, which means your request made it to OSS, "
                    + "but was rejected with an error response for some reason.");
            System.out.println("Error Message:" + oe.getErrorMessage());
            System.out.println("Error Code:" + oe.getErrorCode());
            System.out.println("Request ID:" + oe.getRequestId());
            System.out.println("Host ID:" + oe.getHostId());
        } catch (ClientException ce) {
            System.out.println("Caught an ClientException, which means the client encountered "
                    + "a serious internal problem while trying to communicate with OSS, "
                    + "such as not being able to access the network.");
            System.out.println("Error Message:" + ce.getMessage());
        } finally {
            if (ossClient != null) {
                ossClient.shutdown();
            }
        }
    }
}
<?php
if (is_file(__DIR__ . '/../autoload.php')) {
    require_once __DIR__ . '/../autoload.php';
}
if (is_file(__DIR__ . '/../vendor/autoload.php')) {
    require_once __DIR__ . '/../vendor/autoload.php';
}

use OSS\OssClient;

// Obtain access credentials from environment variables. Before you run the sample code, make sure that the OSS_ACCESS_KEY_ID and OSS_ACCESS_KEY_SECRET environment variables are configured. 
$accessKeyId = getenv("OSS_ACCESS_KEY_ID");
$accessKeySecret = getenv("OSS_ACCESS_KEY_SECRET");
// Specify the endpoint of the region in which the bucket is located. For example, if the bucket is located in the China (Hangzhou) region, set the endpoint to https://oss-cn-hangzhou.aliyuncs.com. 
$endpoint = "yourEndpoint";
// Specify the name of the bucket. Example: examplebucket. 
$bucket= "examplebucket";
// Specify the full path of the source object. Example: exampledir/exampleobject.jpg. Do not include the bucket name in the full path. 
$object = "exampledir/exampleobject.jpg";
// Specify the full path to which you want to save the processed object. Example: example-new.jpg. 
$save_object = "example-new.jpg";

function base64url_encode($data)
{
    return rtrim(strtr(base64_encode($data), '+/', '-_'), '=');
}

$ossClient = new OssClient($accessKeyId, $accessKeySecret, $endpoint, false);
// If the source image that you want to process does not exist in the source bucket, you must upload the image to the source bucket from D:\\localpath\\exampleobject.jpg. 
// $ossClient->uploadFile($bucket, $object, "D:\\localpath\\exampleobject.jpg");

// Resize the image to 100 × 100 pixels and rotate the image 90 degrees. 
$style = "image/resize,m_fixed,w_100,h_100/rotate,90";

$process = $style.
           '|sys/saveas'.
           ',o_'.base64url_encode($save_object).
           ',b_'.base64url_encode($bucket);

// Save the processed image as example-new.png to the current bucket. 
$result = $ossClient->processObject($bucket, $object, $process);
// Display the processing result. 
print($result);
const OSS = require('ali-oss');

const client = new OSS({
  // Specify the region in which the bucket is located. For example, if the bucket is located in the China (Hangzhou) region, set the region to oss-cn-hangzhou. 
  region: 'yourregion',
  // Obtain access credentials from environment variables. Before you run the sample code, make sure that the OSS_ACCESS_KEY_ID and OSS_ACCESS_KEY_SECRET environment variables are configured. 
  accessKeyId: process.env.OSS_ACCESS_KEY_ID,
  accessKeySecret: process.env.OSS_ACCESS_KEY_SECRET,
  // Specify the name of the source bucket. 
  bucket: 'yourbucketname'
});

const sourceImage = 'sourceObject.png';
const targetImage = 'targetObject.jpg';
async function processImage(processStr, targetBucket) {
  const result = await client.processObjectSave(
    sourceImage,
    targetImage,
    processStr,
    targetBucket
  );
  console.log(result.res.status);
}

// Resize the image and save the processed image. 
processImage("image/resize,m_fixed,w_100,h_100")

// Crop the image and save the processed image. 
processImage("image/crop,w_100,h_100,x_100,y_100,r_1")

// Rotate the image and save the processed image. 
processImage("image/rotate,90")

// Sharpen the image and save the processed image. 
processImage("image/sharpen,100")

// Add watermarks to the image and save the processed image. 
processImage("image/watermark,text_SGVsbG8g5Zu-54mH5pyN5YqhIQ")

// Convert the image format and save the processed image. 
processImage("image/format,jpg")

// Convert the format of the image and configure the destination bucket to which you want to save the processed image. 
processImage("image/format,jpg", "target bucket")
# -*- coding: utf-8 -*-
import os
import base64
import oss2
from oss2.credentials import EnvironmentVariableCredentialsProvider

# Obtain access credentials from environment variables. Before you run the sample code, make sure that the OSS_ACCESS_KEY_ID and OSS_ACCESS_KEY_SECRET environment variables are configured. 
auth = oss2.ProviderAuth(EnvironmentVariableCredentialsProvider())
# Specify the endpoint of the region in which the bucket is located. For example, if the bucket is located in the China (Hangzhou) region, set the endpoint to https://oss-cn-hangzhou.aliyuncs.com. 
endpoint = 'https://oss-cn-hangzhou.aliyuncs.com'
# Specify the name of the bucket in which the source image is stored. 
source_bucket_name = 'srcbucket'
# Specify the name of the bucket to which you want to save the processed image. The bucket must be located in the same region as the source bucket. 
taget_bucket_name = 'destbucket'
# Specify the name of the source image. If the image is not stored in the root directory of the bucket, you must specify the full path of the image. Example: example/example.jpg. 
source_image_name = 'example/example.jpg'

# Specify the bucket client. You must use the bucket client to call all object-related methods. 
bucket = oss2.Bucket(auth, endpoint, source_bucket_name)

# Resize the image to 100 × 100 pixels. 
style = 'image/resize,m_fixed,w_100,h_100'
# Specify the name of the processed image. If the image is not stored in the root directory of the bucket, you must specify the full path of the image. Example: exampledir/example.jpg. 
target_image_name = 'exampledir/example.jpg'
process = "{0}|sys/saveas,o_{1},b_{2}".format(style, 
    oss2.compat.to_string(base64.urlsafe_b64encode(oss2.compat.to_bytes(target_image_name))),
    oss2.compat.to_string(base64.urlsafe_b64encode(oss2.compat.to_bytes(taget_bucket_name))))
result = bucket.process_object(source_image_name, process)
print(result)
package main

    import (
        "fmt"
        "os"
        "github.com/aliyun/aliyun-oss-go-sdk/oss"
    )

func main() {
    /// Obtain access credentials from environment variables. Before you run the sample code, make sure that the OSS_ACCESS_KEY_ID and OSS_ACCESS_KEY_SECRET environment variables are configured. 
    provider, err := oss.NewEnvironmentVariableCredentialsProvider()
    if err != nil {
        fmt.Println("Error:", err)
        os.Exit(-1)
    }

    // Create an OSSClient instance. 
    // Specify the endpoint of the region in which the bucket is located. For example, if the bucket is located in the China (Hangzhou) region, set the endpoint to https://oss-cn-hangzhou.aliyuncs.com. Specify your actual endpoint. 
    client, err := oss.New("yourEndpoint", "", "", oss.SetCredentialsProvider(&provider))
    if err != nil {
        fmt.Println("Error:", err)
        os.Exit(-1)
    }   

    // Specify the name of the bucket in which the source image is stored. Example: srcbucket. 
    bucketName := "srcbucket"
    bucket, err := client.Bucket(bucketName)
    if err != nil {
     HandleError(err)
    }
    // Specify the name of the source image. If the source image is not stored in the root directory of the bucket, you must specify the full path of the image. Example: example/example.jpg. 
    sourceImageName := "example/example.jpg"
    // Specify the name of the destination bucket. The destination bucket must be located in the same region as the source bucket. 
    targetBucketName := "destbucket"
    // Specify the name of the processed image. If the image is not stored in the root directory of the bucket, you must specify the full path of the image. Example: exampledir/example.jpg. 
    targetImageName = "exampledir/example.jpg"
    // Resize the image to 100 x 100 pixels and save the image to a specific bucket. 
    style = "image/resize,m_fixed,w_100,h_100"
    process = fmt.Sprintf("%s|sys/saveas,o_%v,b_%v", style, base64.URLEncoding.EncodeToString([]byte(targetImageName)), base64.URLEncoding.EncodeToString([]byte(targetBucketName)))
    result, err = bucket.ProcessObject(sourceImageName, process)
    if err != nil {
    HandleError(err)
    } else {
        fmt.Println(result)
    }
}                      
#include <alibabacloud/oss/OssClient.h>
#include <sstream>
using namespace AlibabaCloud::OSS;

int main(void)
{
    /* Initialize information about the account that is used to access OSS. */
            
    /* Specify the endpoint of the region in which the bucket is located. For example, if the bucket is located in the China (Hangzhou) region, set the endpoint to https://oss-cn-hangzhou.aliyuncs.com. */
    std::string Endpoint = "yourEndpoint";
    /* Specify the name of the source bucket. Example: examplebucket. */
    std::string BucketName = "examplebucket";
    /* Specify the name of the source image. If the source image is not stored in the root directory of the bucket, you must specify the full path of the image. Example: example/example.jpg. */
    std::string SourceObjectName = "example/example.jpg";
    /* Specify the name of the processed image. If the image is not stored in the root directory of the bucket, you must specify the full path of the image. Example: exampledir/example.jpg. */
    std::string TargetObjectName = "exampledir/example.jpg";

    /* Initialize resources, such as network resources. */
    InitializeSdk();

    ClientConfiguration conf;
    /* Obtain access credentials from environment variables. Before you run the sample code, make sure that the OSS_ACCESS_KEY_ID and OSS_ACCESS_KEY_SECRET environment variables are configured. */
    auto credentialsProvider = std::make_shared<EnvironmentVariableCredentialsProvider>();
    OssClient client(Endpoint, credentialsProvider, conf);

    /* Resize the image to 100 x 100 pixels and save the image to the current bucket. */
    std::string Process = "image/resize,m_fixed,w_100,h_100";
    std::stringstream ss;
    ss  << Process 
    <<"|sys/saveas"
    << ",o_" << Base64EncodeUrlSafe(TargetObjectName)
    << ",b_" << Base64EncodeUrlSafe(BucketName);
    ProcessObjectRequest request(BucketName, SourceObjectName, ss.str());
    auto outcome = client.ProcessObject(request);

    /* Release resources, such as network resources. */
    ShutdownSdk();
    return 0;
}

Use the OSS API

If your business requires a high level of customization, you can directly call the OSS RESTful APIs. To directly call an API, you must include the signature calculation in your code.

To process an image, you can call the PostObject operation and pass x-oss-process in the message body of the PostObject request. Then, specify the sys/saveas parameter in the request to save the processed image to a specific bucket. For more information, see PostObject.

The following sample code provides examples on how to save a processed object to a specific bucket:

Use IMG parameters to process an image and save the processed object to a specific bucket

POST /ObjectName?x-oss-process HTTP/1.1
Host: oss-example.oss.aliyuncs.com
Content-Length: 247
Date: Fri, 04 May 2012 03:21:12 GMT
Authorization: OSS qn6q********************:KU5h**********************

// Proportionally resize the source image named test.jpg to a width of 100 pixels and save the processed image to the test bucket. 
x-oss-process=image/resize,w_100|sys/saveas,o_dGVzdC5qcGc,b_dGVzdA

Use style parameters to process an image and save the processed object to a specific bucket

POST /ObjectName?x-oss-process HTTP/1.1
Host: oss-example.oss.aliyuncs.com
Content-Length: 247
Date: Fri, 04 May 2012 03:22:13 GMT
Authorization: OSS qn6q********************:KU5h**********************

// Use a style named examplestyle to process the source image named test.jpg and save the processed image to the test bucket. 
x-oss-process=style/examplestyle|sys/saveas,o_dGVzdC5qcGc,b_dGVzdA

Use processing parameters to change the format of an object and save the processed object to a specific bucket

Information about source and destination objects

  • Source object

    • Object format: DOCX

    • Source object name: example.docx

  • Destination object

    • Object format: PNG

    • Storage path: oss://test-bucket/doc_images/

Sample request

POST /exmaple.docx?x-oss-async-process HTTP/1.1
Host: doc-demo.oss-cn-hangzhou.aliyuncs.com
Date: Fri, 28 Oct 2022 06:40:10 GMT
Authorization: OSS qn6q********************:KU5h**********************

// Change the format of the example.docx object from DOCX to PNG and store the processed image in oss://test-bucket/doc_images/. 
x-oss-async-process=doc/convert,target_png,source_docx|sys/saveas,b_dGVzdC1idWNrZXQ,o_ZG9jX2ltYWdlcy97aW5kZXh9LnBuZw

Use style parameters to process an object and save the processed object to a specific bucket

Information about source and destination objects

  • Source object

    • Object format: DOCX

    • Source object name: example.docx

  • Destination object

    Storage path: oss://test-bucket/doc_images/

Sample request

POST /exmaple.docx?x-oss-async-process HTTP/1.1
Host: doc-demo.oss-cn-hangzhou.aliyuncs.com
Date: Fri, 28 Oct 2022 06:40:10 GMT
Authorization: OSS qn6q********************:KU5h************************
 
 // Use the examplestyle style to process the example.docx object and store the processed object in oss://test-bucket/doc_images/. 
x-oss-async-process=style/examplestyle|sys/saveas,b_dGVzdC1idWNrZXQ,o_ZG9jX2ltYWdlcy97aW5kZXh9LnBuZw

Use processing parameters to transcode a video and save the processed object to a specific bucket

Information about source and destination objects

  • Source object

    • Video format: AVI

    • Video name: example.avi

  • Destination object

    • Video information

      • Video format: MP4

      • Video name: outobjprefix.mp4

      • Video stream format: H.265

      • Video resolution: 1920 × 1080

      • Video frame rate: 30 fps

      • Video bitrate: 2 Mbit/s

    • Audio information

      • Audio stream format: AAC

      • Audio bitrate: 100 Kbit/s

      • Subtitle stream: disabled

    • Video storage path: oss://outbucket/outobj.mp4

Sample request

POST /exmaple.avi?x-oss-async-process HTTP/1.1
Host: video-demo.oss-cn-hangzhou.aliyuncs.com
Date: Fri, 28 Oct 2022 06:40:10 GMT
Authorization: OSS qn6q********************:KU5h************************

// Transcode the example.avi object to change the object format to MP4, video stream format to H.265, resolution to 1920 x 1080, frame rate to 30 fps, video bit rate to 2 Mbit/s, audio stream format to AAC, and the audio bit rate to 100 Kbit/s, and disable the subtitle stream. After transcoding, save the processed object as oss://outbucket/outobj.mp4. 
x-oss-async-process=video/convert,f_mp4,vcodec_h265,s_1920x1080,vb_2000000,fps_30,acodec_aac,ab_100000,sn_1|sys/saveas,o_b3V0b2JqLnthdXRvZXh0fQo,o_b3V0b2JqcHJlZml4LnthdXRvZXh0fQ

Use style parameters to transcode a video and save the processed object to a specific bucket

Information about source and destination objects

  • Source object

    • Video format: AVI

    • Video name: example.avi

  • Destination object

    • Video format: MP4

    • Video name: outobjprefix.mp4

    • Video storage path: oss://outbucket/outobjprefix.mp4

Sample request

POST /exmaple.avi?x-oss-async-process HTTP/1.1
Host: video-demo.oss-cn-hangzhou.aliyuncs.com
Date: Fri, 28 Oct 2022 06:40:10 GMT
Authorization: OSS qn6q********************:KU5h************************
 
 // Use the examplestyle style to transcode the example.avi object and save the processed object as oss://outbucket/outobjprefix.mp4. 
x-oss-async-process=style/examplestyle|sys/saveas,b_b3V0YnVja2V0,o_b3V0b2JqcHJlZml4LnthdXRvZXh0fQ

Use processing parameters to transform a video into an animated sticker and save the processed object to a specific bucket

Information about source and destination objects

  • Source object

    • Video name: example.mkv

  • Destination object

    • Animated sticker

      • Format: GIF

      • Video interval: 1s

      • Resolution: 100 x 100

    • Object storage path

      • oss://outbucket/outobjprefix.gif

Sample request

POST /example.mkv?x-oss-async-process HTTP/1.1
Host: video-demo.oss-cn-hangzhou.aliyuncs.com
Date: Fri, 28 Oct 2022 06:40:10 GMT
Authorization: OSS qn6q********************:KU5h************************
 
// Transform the example.mkv object into an animated sticker whose format is GIF, size is 100 x 100 pixels, and interval is 1 second. After the transformation is complete, save the processed object as oss://outbucket/outobjprefix.gif. 
x-oss-async-process=video/animation,f_gif,w_100,h_100,inter_1000|sys/saveas,b_b3V0YnVja2V0,o_b3V0b2JqcHJlZml4LnthdXRvZXh0fQ

Use style parameters to transform a video into an animated sticker and save the processed object to a specific bucket

Information about source and destination objects

  • Source object

    • Video name: example.mkv

  • Animated sticker

    • Format: GIF

  • Destination object

    • Object storage path

      • oss://outbucket/outobjprefix.gif

Sample request

POST /example.mkv?x-oss-async-process HTTP/1.1
Host: video-demo.oss-cn-hangzhou.aliyuncs.com
Date: Fri, 28 Oct 2022 06:40:10 GMT
Authorization: OSS qn6q********************:KU5h************************
 
// Use the examplestyle style to transform the example.mkv object into an animated sticker. After the transformation is complete, save the processed object as oss://outbucket/outobjprefix.gif. 
x-oss-async-process=style/examplestyle|sys/saveas,b_b3V0YnVja2V0,o_b3V0b2JqcHJlZml4LnthdXRvZXh0fQ

Use processing parameters to capture sprite snapshots from a video and save the sprite snapshots to a specific bucket

Information about source and destination objects

  • Source object

    • Video name: example.mkv

  • Destination object

    • Sprite snapshots

      • Format: JPG

      • Time interval for capturing sprite snapshots: 10s

      • Sub-image resolution: 100 x 100

      • Sprite snapshot configurations: 10 images in a row. 10 images in a column. Both the pad and margin are 0.

    • Object storage path

      • oss://outbucket/outobjprefix-%d.jpg

Sample request

POST /example.mkv?x-oss-async-process HTTP/1.1
Host: video-demo.oss-cn-hangzhou.aliyuncs.com
Date: Fri, 28 Oct 2022 06:40:10 GMT
Authorization: OSS qn6q********************:KU5h************************
 
// Capture sprite snapshots from the example.mkv object. 
x-oss-async-process=video/sprite,f_jpg,sw_100,sh_100,inter_10000,tw_10,th_10,pad_0,margin_0|sys/saveas,b_b3V0YnVja2V0,o_b3V0b2JqcHJlZml4LXtpbmRleH0ue2F1dG9leHR9Cg

Use style parameters to capture sprite snapshots from a video and save the sprite snapshots to a specific bucket

Information about source and destination objects

  • Source object

    • Video name: example.mkv

  • Destination object

    • Sprite snapshots

      • Format: JPG

    • Object storage path

      • oss://outbucket/outobjprefix-%d.jpg

Sample request

POST /example.mkv?x-oss-async-process HTTP/1.1
Host: video-demo.oss-cn-hangzhou.aliyuncs.com
Date: Fri, 28 Oct 2022 06:40:10 GMT
Authorization: OSS qn6q********************:KU5h************************
 
// Use the examplestyle style to capture sprite snapshots from the example.mkv object. 
x-oss-async-process=style/examplestyle|sys/saveas,b_b3V0YnVja2V0,o_b3V0b2JqcHJlZml4LXtpbmRleH0ue2F1dG9leHR9Cg

Use processing parameters to capture snapshots from a video and save the snapshots to a specific bucket

Information about source and destination objects

  • Source object

    • Video name: example.mkv

  • Destination object

    • Snapshot information

      • Format: JPG

      • Time interval for capturing snapshots: 10s

      • Resolution: 100 x 100

    • Object storage path

      • oss://outbucket/outobjprefix-%d.jpg

Sample request

POST /example.mkv?x-oss-async-process HTTP/1.1
Host: video-demo.oss-cn-hangzhou.aliyuncs.com
Date: Fri, 28 Oct 2022 06:40:10 GMT
Authorization: OSS qn6q********************:KU5h************************
 
// Capture snapshots from the example.mkv object. 
x-oss-async-process=video/snapshots,f_jpg,w_100,h_100,scaletype_crop,inter_10000|sys/saveas,b_b3V0YnVja2V0,o_b3V0b2JqcHJlZml4LXtpbmRleH0ue2F1dG9leHR9Cg

Use style parameters to capture snapshots from a video and save the snapshots to a specific bucket

Information about source and destination objects

  • Source object

    • Video name: example.mkv

  • Destination object

    • Snapshot information

      • Format: JPG

    • Object storage path

      • oss://outbucket/outobjprefix-%d.jpg

Sample request

POST /example.mkv?x-oss-async-process HTTP/1.1
Host: video-demo.oss-cn-hangzhou.aliyuncs.com
Date: Fri, 28 Oct 2022 06:40:10 GMT
Authorization: OSS qn6q********************:KU5h**********************
 
// Use the examplestyle style to capture snapshots from the example.mkv object. 
x-oss-async-process=style/examplestyle|sys/saveas,b_b3V0YnVja2V0,o_b3V0b2JqcHJlZml4LXtpbmRleH0ue2F1dG9leHR9Cg

Use processing parameters to merge videos and save the merged video to a specific bucket

Information about source and destination objects

  • Source objects

    • Video names: pre.mov, example.mkv, sur.mov

  • Merge method

    • Duration and sequence:

      Video name

      Sequence

      Duration

      pre.mov

      1

      Entire video

      example.mkv

      2

      From the 10th second to the end of the video

      sur.mov

      3

      From the start of the video to the 10th second

  • Destination object

    • Video information

      • Video format: h264

      • Video frame rate: 25 fps

      • Video bitrate: 1 Mbit/s

    • Audio information

      • Audio format: AAC

      • Audio configurations: sampling rate of 48 kHz and binaural sound channels

      • Audio bitrate: 96 Kbit/s

    • Object storage path

      • oss://outbucket/outobjprefix.mp4

Sample request

POST /exmaple.mkv?x-oss-async-process HTTP/1.1
Host: video-demo.oss-cn-hangzhou.aliyuncs.com
Date: Fri, 28 Oct 2022 06:40:10 GMT
Authorization: OSS qn6q********************:KU5h**********************
 
// Merge pre.mov, example.mkv, and sur.mov into a new video based on the preceding requirements. 
x-oss-async-process=video/concat,ss_10000,f_mp4,vcodec_h264,fps_25,vb_1000000,acodec_aac,ab_96000,ar_48000,ac_2,align_1/pre,o_cHJlLm1vdgo/sur,o_c3VyLm1vdg,t_10000|sys/saveas,b_b3V0YnVja2V0,o_b3V0b2JqcHJlZml4LnthdXRvZXh0fQ

Use processing parameters to transcode an audio object and save the processed object to a specific bucket

Information about source and destination objects

  • Source object

    • Audio format: MP3

    • Audio name: example.mp3

  • Handling method

    • Transcoding duration: from 1,000 millisecond of the audio object to 60,000 millisecond

  • Destination object

    • Audio information

      • Audio format: AAC

      • Audio configurations: keep the original sampling rate and sound channels

      • Audio bitrate: 96 Kbit/s

    • Object storage path

      • oss://outbucket/outobjprefix.aac

Sample request

POST /exmaple.mp3?x-oss-async-process HTTP/1.1
Host: video-demo.oss-cn-hangzhou.aliyuncs.com
Date: Fri, 28 Oct 2022 06:40:10 GMT
Authorization: OSS qn6q********************:KU5h**********************
 
// Perform audio transcoding on example.mp3. 
x-oss-async-process=audio/convert,ss_10000,t_60000,f_aac,ab_96000|sys/saveas,b_b3V0YnVja2V0,o_b3V0b2JqcHJlZml4LnthdXRvZXh0fQ

Use style parameters to transcode an audio object and save the processed object to a specific bucket

Information about source and destination objects

  • Source object

    • Audio format: MP3

    • Audio name: example.mp3

  • Destination object

    • Audio information

      • Audio format: AAC

    • Object storage path

      • oss://outbucket/outobjprefix.aac

Sample request

POST /exmaple.mp3?x-oss-async-process HTTP/1.1
Host: video-demo.oss-cn-hangzhou.aliyuncs.com
Date: Fri, 28 Oct 2022 06:40:10 GMT
Authorization: OSS qn6q********************:KU5h**********************
 
// Use the examplestyle style to perform audio transcoding on the example.mp3 object. 
x-oss-async-process=style/examplestyle|sys/saveas,b_b3V0YnVja2V0,o_b3V0b2JqcHJlZml4LnthdXRvZXh0fQ

Use processing parameters to merge audio objects and save the merged audio to a specific bucket

Information about source and destination objects

  • Source objects

    • Audio names: pre1.mp3, pre2.wav, example.mp3, sur1.aac, and sur2.wma

  • Merge method

    • Duration and sequence:

      Audio name

      Sequence

      Duration

      pre1.mp3

      1

      Entire audio object

      pre2.wav

      2

      First 2 seconds

      example.mp3

      3

      Entire audio object

      sur1.aac

      4

      From the 4th second to the 10th second

      sur2.wma

      5

      From the 10th second to the end of the audio object

  • Destination object

    • Audio information

      • Audio format: AAC

      • Audio configurations: sampling rate of 48 kHz and mono sound channel

      • Audio bitrate: 96 Kbit/s

    • Object storage path

      • oss://outbucket/outobjprefix.aac

Sample request

POST /exmaple.mp3?x-oss-async-process HTTP/1.1
Host: video-demo.oss-cn-hangzhou.aliyuncs.com
Date: Fri, 28 Oct 2022 06:40:10 GMT
Authorization: OSS qn6q********************:KU5h**********************
 
// Merge pre1.mp3, pre2.wav, example.mp3, sur1.aac, and sur2.wma into a new audio object based on the preceding requirements. 
x-oss-async-process=audio/concat,f_aac,ab_96000,ar_48000,ac_1,align_2/pre,o_cHJlMS5tcDMK/pre,o_cHJlMi53YXYK,t_2000/sur,o_c3VyMS5hYWMK,ss_4000,t_10000/sur,o_c3VyMi53bWEK,ss_10000|sys/saveas,b_b3V0YnVja2V0,o_b3V0b2JqcHJlZml4LnthdXRvZXh0fQ