This topic describes the Save As feature, including its concept, important notes, parameters, and examples.
What is save as
By default, synchronous processing operations do not save the resulting file. To save the file, you must add the Save As parameter to your request and specify a destination bucket. Asynchronous processing operations are task-based and return only a task ID. Therefore, you must use the Save As parameter to save the processed file to a bucket for later access.
Notes
Permission requirements:
The Save As operation requires the
oss:PostProcessTaskpermission for the source bucket and theoss:PutObjectpermission for the destination object.The access control list (ACL) of the saved file inherits the ACL from the bucket by default. Custom ACLs are not supported.
Region requirements: The source bucket and the destination bucket can be the same or different. However, they must belong to the same Alibaba Cloud account and be in the same region.
Save As method: Saving a file processed from a URL directly to a bucket is not supported. You must save the processed file to your local computer and then upload it to the destination bucket.
Storage duration of saved files: To adjust the storage duration of saved files, you can configure a file expiration policy using lifecycle rules. For more information, see Introduction to lifecycle rules.
Parameters
When you use the sys/saveas parameter, include the following options:
Option | Meaning |
o | The name of the destination object. The name must be URL-safe Base64 encoded. For more information, see Encode watermarks. Note The o option supports variables. The variable format is {varname} or a combination of a string and {varname}. For more information, see Variables. |
b | The name of the destination bucket. The name must be URL-safe Base64 encoded. If you do not specify a destination bucket, the file is saved to the source bucket by default. Note The b option supports variables. The variable format is {varname} or a combination of a string and {varname}. For more information, see Variables. |
Use Alibaba Cloud SDKs
You can save files that are processed using Alibaba Cloud SDKs to a specified bucket by adding the `sys/saveas` parameter. The following code provides examples of how to save processed images using common SDKs. For examples of how to use other SDKs, see Overview.
import com.aliyun.oss.*;
import com.aliyun.oss.common.auth.*;
import com.aliyun.oss.common.comm.SignVersion;
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 {
// The China (Hangzhou) region is used in this example. Specify the actual endpoint.
String endpoint = "https://oss-cn-hangzhou.aliyuncs.com";
// Specify the region ID that corresponds to the endpoint. For example, cn-hangzhou.
String region = "cn-hangzhou";
// We strongly recommend that you do not save your access credentials in your project code. This may cause your access credentials to be leaked, which threatens the security of all resources in your account. This example shows how to obtain access credentials from environment variables. Before you run this example, configure the environment variables.
EnvironmentVariableCredentialsProvider credentialsProvider = CredentialsProviderFactory.newEnvironmentVariableCredentialsProvider();
// Specify the bucket name. For example, examplebucket.
String bucketName = "examplebucket";
// Specify the full path of the object. The full path cannot contain the bucket name.
String sourceImage = "exampleimage.png";
// Create an OSSClient instance.
// When the OSSClient instance is no longer used, call the shutdown method to release resources.
ClientBuilderConfiguration clientBuilderConfiguration = new ClientBuilderConfiguration();
// Explicitly declare the use of the V4 signature algorithm.
clientBuilderConfiguration.setSignatureVersion(SignVersion.V4);
OSS ossClient = OSSClientBuilder.create()
.endpoint(endpoint)
.credentialsProvider(credentialsProvider)
.clientConfiguration(clientBuilderConfiguration)
.region(region)
.build();
try {
// Resize the image to a fixed size of 100 px × 100 px.
StringBuilder sbStyle = new StringBuilder();
Formatter styleFormatter = new Formatter(sbStyle);
String styleType = "image/resize,m_fixed,w_100,h_100";
// Name the processed image example-resize.png and save it to the current bucket.
// Specify the full path of the object. The full path cannot contain the bucket name.
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 this example, 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");
// Set yourEndpoint to the endpoint of the region where the bucket is located. For example, if the bucket is in the China (Hangzhou) region, set the endpoint to https://oss-cn-hangzhou.aliyuncs.com.
$endpoint = "yourEndpoint";
// Specify the bucket name. For example, examplebucket.
$bucket= "examplebucket";
// Specify the full path of the source object. For example, exampledir/exampleobject.jpg. The full path cannot contain the bucket name.
$object = "exampledir/exampleobject.jpg";
// Specify the full path of the destination object. For 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 destination image is not in the specified bucket, upload the image to the destination bucket.
// $ossClient->uploadFile($bucket, $object, "D:\\localpath\\exampleobject.jpg");
// Resize the image to a fixed size of 100 px × 100 px, and then rotate it 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);
// Name the processed image example-new.png and save it to the current bucket.
$result = $ossClient->processObject($bucket, $object, $process);
// Print the processing result.
print($result);const OSS = require('ali-oss');
const client = new OSS({
// Set yourregion to the region where the bucket is located. For example, if the bucket is in the China (Hangzhou) region, set the region to oss-cn-hangzhou.
region: 'yourregion',
// Obtain access credentials from environment variables. Before you run this example, 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 bucket name.
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);
}
// Persistently scale the image.
processImage("image/resize,m_fixed,w_100,h_100")
// Persistently crop the image.
processImage("image/crop,w_100,h_100,x_100,y_100,r_1")
// Persistently rotate the image.
processImage("image/rotate,90")
// Persistently sharpen the image.
processImage("image/sharpen,100")
// Persistently add a watermark to the image.
processImage("image/watermark,text_SGVsbG8g5Zu-54mH5pyN5YqhIQ")
// Persistently convert the image format.
processImage("image/format,jpg")
// Persistently convert the image format and set the destination bucket to save the result.
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 this example, make sure that the OSS_ACCESS_KEY_ID and OSS_ACCESS_KEY_SECRET environment variables are configured.
auth = oss2.ProviderAuth(EnvironmentVariableCredentialsProvider())
# Set the endpoint to the one that corresponds to the region where the bucket is located. For example, if the bucket is 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 where the source image is stored.
source_bucket_name = 'srcbucket'
# Specify the name of the bucket used to store the processed image. This bucket must be in the same region as the source bucket.
target_bucket_name = 'destbucket'
# Specify the name of the source image. If the image is not in the root directory of the bucket, you must specify the full path of the file. For example, example/example.jpg.
source_image_name = 'example/example.jpg'
# Specify the bucket instance. All file-related methods must be called through the bucket instance.
bucket = oss2.Bucket(auth, endpoint, source_bucket_name)
# Resize the image to a fixed size of 100 px × 100 px.
style = 'image/resize,m_fixed,w_100,h_100'
# Specify the name of the processed image. If the image is not in the root directory of the bucket, you must specify the full path of the file. For 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(target_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 this example, 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.
// Set yourEndpoint to the endpoint of the bucket. For example, if the bucket is in the China (Hangzhou) region, set the endpoint to https://oss-cn-hangzhou.aliyuncs.com. Set other region endpoints as needed.
client, err := oss.New("yourEndpoint", "", "", oss.SetCredentialsProvider(&provider))
if err != nil {
fmt.Println("Error:", err)
os.Exit(-1)
}
// Specify the name of the bucket where the source image is stored. For example, srcbucket.
bucketName := "srcbucket"
bucket, err := client.Bucket(bucketName)
if err != nil {
HandleError(err)
}
// Specify the name of the source image. If the image is not in the root directory of the bucket, specify the full path of the file. For example, example/example.jpg.
sourceImageName := "example/example.jpg"
// Specify the name of the bucket used to store the processed image. This bucket must be in the same region as the source bucket.
targetBucketName := "destbucket"
// Specify the name of the processed image. If the image is not in the root directory of the bucket, specify the full path of the file. For example, exampledir/example.jpg.
targetImageName = "exampledir/example.jpg"
// Resize the image to a fixed size of 100 px × 100 px and save it to the specified 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 the information about the Alibaba Cloud account. */
/* Specify the endpoint that corresponds to the region where the bucket is located. For example, if the bucket is in the China (Hangzhou) region, set the endpoint to https://oss-cn-hangzhou.aliyuncs.com. */
std::string Endpoint = "yourEndpoint";
/* Specify the bucket name. For example, examplebucket. */
std::string BucketName = "examplebucket";
/* Specify the name of the source image. If the image is not in the root directory of the bucket, specify the full path of the file. For example, example/example.jpg. */
std::string SourceObjectName = "example/example.jpg";
/* Specify the name of the processed image. If the image is not in the root directory of the bucket, specify the full path of the file. For example, exampledir/example.jpg. */
std::string TargetObjectName = "exampledir/example.jpg";
/* Initialize resources such as the network. */
InitializeSdk();
ClientConfiguration conf;
/* Obtain access credentials from environment variables. Before you run this example, 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 a fixed size of 100 px × 100 px and save it 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 the network. */
ShutdownSdk();
return 0;
}Use the REST API
To customize your program, you can directly send REST API requests and manually write code to calculate signatures.
When you call the PostObject operation to process a file, pass x-oss-process in the request body and add the sys/saveas parameter to the request to save the processed file to a specified bucket. For more information, see PostObject.
The following sections provide request examples for different Save As scenarios.
Process an image using processing parameters and save it to a specified 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: OSS4-HMAC-SHA256 Credential=LTAI********************/20250417/cn-hangzhou/oss/aliyun_v4_request,AdditionalHeaders=content-length,Signature=a7c3554c729d71929e0b84489addee6b2e8d5cb48595adfc51868c299c0c218e
// Proportionally resize the destination image test.jpg to a width of 100 px and save it to a bucket named test.
x-oss-process=image/resize,w_100|sys/saveas,o_dGVzdC5qcGc,b_dGVzdAProcess an image using style parameters and save it to a specified 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: OSS4-HMAC-SHA256 Credential=LTAI********************/20250417/cn-hangzhou/oss/aliyun_v4_request,AdditionalHeaders=content-length,Signature=a7c3554c729d71929e0b84489addee6b2e8d5cb48595adfc51868c299c0c218e
// Process the destination image test.jpg using a style named examplestyle and save the processed image to a bucket named test.
x-oss-process=style/examplestyle|sys/saveas,o_dGVzdC5qcGc,b_dGVzdAConvert a document using processing parameters and save it to a specified bucket
Conversion information
Before conversion
File type: DOCX
File name:
example.docx
After conversion
File type: PNG
File storage path:
oss://test-bucket/doc_images/
Request example
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: OSS4-HMAC-SHA256 Credential=LTAI********************/20250417/cn-hangzhou/oss/aliyun_v4_request,Signature=a7c3554c729d71929e0b84489addee6b2e8d5cb48595adfc51868c299c0c218e
// Convert the DOCX file example.docx to PNG image files and store the converted images in the oss://test-bucket/doc_images/ path.
x-oss-async-process=doc/convert,target_png,source_docx|sys/saveas,b_dGVzdC1idWNrZXQ,o_ZG9jX2ltYWdlcy97aW5kZXh9LnBuZwConvert a document using style parameters and save it to a specified bucket
Conversion information
Before conversion
File type: DOCX
File name:
example.docx
After conversion
File storage path:
oss://test-bucket/doc_images/
Request example
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: OSS4-HMAC-SHA256 Credential=LTAI********************/20250417/cn-hangzhou/oss/aliyun_v4_request,Signature=a7c3554c729d71929e0b84489addee6b2e8d5cb48595adfc51868c299c0c218e
// Convert the file example.docx using a style named examplestyle and store the converted files in the oss://test-bucket/doc_images/ path.
x-oss-async-process=style/examplestyle|sys/saveas,b_dGVzdC1idWNrZXQ,o_ZG9jX2ltYWdlcy97aW5kZXh9LnBuZwTranscode a video using processing parameters and save it to a specified bucket
Transcoding information
Before transcoding
Video format: AVI
Video name:
example.avi
After transcoding
Video information
Video format: MP4
Video name:
outobjprefix.mp4Video stream format: H.265
Video resolution: 1920×1080
Video frame rate: 30 fps
Video bitrate: 2 Mbps
Audio information
Audio stream format: AAC
Audio bitrate: 100 Kbps
Subtitle stream: Disabled
Video storage path:
oss://outbucket/outobj.mp4
Request example
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: OSS4-HMAC-SHA256 Credential=LTAI********************/20250417/cn-hangzhou/oss/aliyun_v4_request,Signature=a7c3554c729d71929e0b84489addee6b2e8d5cb48595adfc51868c299c0c218e
// Transcode the file example.avi. The output media container is MP4. The video stream format is H.265, the resolution is 1920x1080, the frame rate is 30 fps, and the video bitrate is 2 Mbps. The audio stream format is AAC and the audio bitrate is 100 Kbps. The subtitle stream is disabled. After transcoding, save the resulting file 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_b3V0b2JqcHJlZml4LnthdXRvZXh0fQTranscode a video using style parameters and save it to a specified bucket
Transcoding information
Before transcoding
Video format: AVI
Video name:
example.avi
After transcoding
Format: MP4
Name:
outobjprefix.mp4Path:
oss://outbucket/outobjprefix.mp4
Request example
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: OSS4-HMAC-SHA256 Credential=LTAI********************/20250417/cn-hangzhou/oss/aliyun_v4_request,Signature=a7c3554c729d71929e0b84489addee6b2e8d5cb48595adfc51868c299c0c218e
// Transcode the file example.avi using a style named examplestyle. After transcoding, save the resulting file as oss://outbucket/outobjprefix.mp4.
x-oss-async-process=style/examplestyle|sys/saveas,b_b3V0YnVja2V0,o_b3V0b2JqcHJlZml4LnthdXRvZXh0fQGenerate an animated image from a video using processing parameters and save it to a specified bucket
Snapshot information
Graph before rotation
Video name: example.mkv
After graph rotation
Animated image information
Animated image format: GIF
Video interval: 1 s
Output image resolution: 100×100
File storage path
GIF file: oss://outbucket/outobjprefix.gif
Request example
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: OSS4-HMAC-SHA256 Credential=LTAI********************/20250417/cn-hangzhou/oss/aliyun_v4_request,Signature=a7c3554c729d71929e0b84489addee6b2e8d5cb48595adfc51868c299c0c218e
// Generate an animated image from the file example.mkv. The animated image format is GIF, the output image width is 100 px, the height is 100 px, and the interval is 1 second. After the conversion, save the resulting file as oss://outbucket/outobjprefix.gif.
x-oss-async-process=video/animation,f_gif,w_100,h_100,inter_1000|sys/saveas,b_b3V0YnVja2V0,o_b3V0b2JqcHJlZml4LnthdXRvZXh0fQGenerate an animated image from a video using style parameters and save it to a specified bucket
Snapshot information
Before generating the animated image
Video name: example.mkv
Animated image information
Animated image format: GIF
After graph rotation
File storage path
GIF file: oss://outbucket/outobjprefix.gif
Request example
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: OSS4-HMAC-SHA256 Credential=LTAI********************/20250417/cn-hangzhou/oss/aliyun_v4_request,Signature=a7c3554c729d71929e0b84489addee6b2e8d5cb48595adfc51868c299c0c218e
// Generate an animated image from the file example.mkv using a style named examplestyle. After the conversion, save the resulting file as oss://outbucket/outobjprefix.gif.
x-oss-async-process=style/examplestyle|sys/saveas,b_b3V0YnVja2V0,o_b3V0b2JqcHJlZml4LnthdXRvZXh0fQGenerate a sprite from a video using processing parameters and save it to a specified bucket
Snapshot information
Before generating the sprite
Video name: example.mkv
After generating the sprite
Sprite Information
Sprite format: JPG
Frame interval: 10 s
Sub-image resolution: 100×100
Sprite configuration: 10 images per row and 10 images per column, with the padding and margin both set to 0.
File storage path
JPG file: oss://outbucket/outobjprefix-%d.jpg
Request example
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: OSS4-HMAC-SHA256 Credential=LTAI********************/20250417/cn-hangzhou/oss/aliyun_v4_request,Signature=a7c3554c729d71929e0b84489addee6b2e8d5cb48595adfc51868c299c0c218e
// Generate a sprite from the file example.mkv.
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_b3V0b2JqcHJlZml4LXtpbmRleH0ue2F1dG9leHR9CgGenerate a sprite from a video using style parameters and save it to a specified bucket
Snapshot information
Before generating the sprite
Video name: example.mkv
After generating the sprite
Sprite information
Sprite format: JPG
File storage path
JPG file: oss://outbucket/outobjprefix-%d.jpg
Request example
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: OSS4-HMAC-SHA256 Credential=LTAI********************/20250417/cn-hangzhou/oss/aliyun_v4_request,Signature=a7c3554c729d71929e0b84489addee6b2e8d5cb48595adfc51868c299c0c218e
// Generate a sprite from the file example.mkv using a style named examplestyle.
x-oss-async-process=style/examplestyle|sys/saveas,b_b3V0YnVja2V0,o_b3V0b2JqcHJlZml4LXtpbmRleH0ue2F1dG9leHR9CgTake video snapshots using processing parameters and save them to a specified bucket
Snapshot information
Before taking snapshots
Video name: example.mkv
After taking snapshots
Snapshot information
Snapshot format: JPG
Video interval: 10 s
Output image resolution: 100×100
File storage path
JPG file: oss://outbucket/outobjprefix-%d.jpg
Request example
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: OSS4-HMAC-SHA256 Credential=LTAI********************/20250417/cn-hangzhou/oss/aliyun_v4_request,Signature=a7c3554c729d71929e0b84489addee6b2e8d5cb48595adfc51868c299c0c218e
// Take video snapshots of the file example.mkv.
x-oss-async-process=video/snapshots,f_jpg,w_100,h_100,scaletype_crop,inter_10000|sys/saveas,b_b3V0YnVja2V0,o_b3V0b2JqcHJlZml4LXtpbmRleH0ue2F1dG9leHR9CgTake video snapshots using style parameters and save them to a specified bucket
Snapshot information
Before taking snapshots
Video name: example.mkv
After taking snapshots
Snapshot information
Snapshot format: JPG
File storage path
JPG file: oss://outbucket/outobjprefix-%d.jpg
Request example
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: OSS4-HMAC-SHA256 Credential=LTAI********************/20250417/cn-hangzhou/oss/aliyun_v4_request,Signature=a7c3554c729d71929e0b84489addee6b2e8d5cb48595adfc51868c299c0c218e
// Take video snapshots of the file example.mkv using a style named examplestyle.
x-oss-async-process=style/examplestyle|sys/saveas,b_b3V0YnVja2V0,o_b3V0b2JqcHJlZml4LXtpbmRleH0ue2F1dG9leHR9CgConcatenate videos using processing parameters and save the output to a specified bucket
Concatenation information
Before concatenation
Video names: pre.mov, example.mkv, sur.mov
Processing method
Concatenation duration and order:
Video name
Order
Duration
pre.mov
1
Entire video
example.mkv
2
From the 10th second to the end
sur.mov
3
From the beginning to the 10th second
After concatenation
Video information
Video format: H.264
Video frame rate: 25 fps
Video bitrate: 1 Mbps
Audio information
Audio format: AAC
Audio configuration: 48 kHz sample rate, two sound channels
Audio bitrate: 96 Kbps
File storage path
MP4 file: oss://outbucket/outobjprefix.mp4
Request example
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: OSS4-HMAC-SHA256 Credential=LTAI********************/20250417/cn-hangzhou/oss/aliyun_v4_request,Signature=a7c3554c729d71929e0b84489addee6b2e8d5cb48595adfc51868c299c0c218e
// Concatenate videos with the file example.mkv.
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_b3V0b2JqcHJlZml4LnthdXRvZXh0fQTranscode an audio file using processing parameters and save it to a specified bucket
Transcoding information
Before transcoding
Audio format: MP3
Audio name: example.mp3
Processing method
Transcoding duration: The audio is transcoded for 60,000 milliseconds, starting from the 1,000th millisecond of the input media file.
After transcoding
Audio information
Audio format: AAC
Audio configuration: The original sample rate and number of sound channels are retained.
Audio bitrate: 96 Kbps
File storage path
AAC file: oss://outbucket/outobjprefix.aac
Request example
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: OSS4-HMAC-SHA256 Credential=LTAI********************/20250417/cn-hangzhou/oss/aliyun_v4_request,Signature=a7c3554c729d71929e0b84489addee6b2e8d5cb48595adfc51868c299c0c218e
// Transcode the audio file example.mp3.
x-oss-async-process=audio/convert,ss_10000,t_60000,f_aac,ab_96000|sys/saveas,b_b3V0YnVja2V0,o_b3V0b2JqcHJlZml4LnthdXRvZXh0fQTranscode an audio file using style parameters and save it to a specified bucket
Transcoding information
Before transcoding
Audio format: MP3
Audio name: example.mp3
After transcoding
Audio information
Audio format: AAC
File storage path
AAC file: oss://outbucket/outobjprefix.aac
Request example
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: OSS4-HMAC-SHA256 Credential=LTAI********************/20250417/cn-hangzhou/oss/aliyun_v4_request,Signature=a7c3554c729d71929e0b84489addee6b2e8d5cb48595adfc51868c299c0c218e
// Transcode the audio file example.mp3 using a style named examplestyle.
x-oss-async-process=style/examplestyle|sys/saveas,b_b3V0YnVja2V0,o_b3V0b2JqcHJlZml4LnthdXRvZXh0fQConcatenate audio files using processing parameters and save the output to a specified bucket
Concatenation information
Before concatenation
Audio names: pre1.mp3, pre2.wav, example.mp3, sur1.aac, sur2.wma
Processing method
Concatenation duration and order:
Audio name
Order
Duration
pre1.mp3
1
Entire audio
pre2.wav
2
First 2 seconds
example.mp3
3
Entire audio
sur1.aac
4
From the 4th second to the 10th second
sur2.wma
5
From the 10th second to the end
After concatenation
Audio information
Audio format: AAC
Audio configuration: 48 kHz sample rate, single sound channel
Audio bitrate: 96 Kbps
File storage path
AAC file: oss://outbucket/outobjprefix.aac
Request example
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: OSS4-HMAC-SHA256 Credential=LTAI********************/20250417/cn-hangzhou/oss/aliyun_v4_request,Signature=a7c3554c729d71929e0b84489addee6b2e8d5cb48595adfc51868c299c0c218e
// Concatenate audio files with the file example.mp3.
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