Este tópico descreve o conceito e as notas de uso do parâmetro sys/saveas, além de fornecer exemplos de utilização.
O que é sys/saveas?
Por padrão, objetos processados de forma síncrona não são salvos. Para salvar o objeto processado em um bucket específico, especifique o parâmetro sys/saveas na requisição. O processamento assíncrono funciona como uma tarefa e retorna apenas o ID da tarefa. Portanto, especifique o parâmetro sys/saveas antes de enviar a requisição para garantir que o objeto processado seja salvo em um bucket específico para acesso posterior.
Notas de uso
-
Permissões necessárias:
Para salvar um objeto processado, você precisa ter a permissão
oss:PostProcessTaskno bucket de origem onde o objeto original está armazenado e a permissãooss:PutObjectno objeto processado.A lista de controle de acesso (ACL) de um objeto processado é igual à do bucket de destino e não pode ser alterada.
Requisitos de região: É possível salvar o objeto processado no mesmo bucket do objeto de origem ou em um bucket diferente. No entanto, ambos devem pertencer à mesma conta Alibaba Cloud e estar localizados na mesma região.
Método de armazenamento: Não é possível salvar diretamente em um bucket específico objetos processados por meio de URLs. Baixe os objetos processados para o computador local e faça o upload deles para o bucket de destino.
Duração de armazenamento dos objetos processados: Caso deseje armazenar um objeto processado por um período determinado, configure uma regra de ciclo de vida para definir quando ele expira. Para mais informações, consulte Visão geral.
Descrição do parâmetro
Ao especificar o parâmetro sys/saveas em uma requisição, defina as opções descritas na tabela a seguir.
|
Opção |
Descrição |
|
o |
Nome do objeto processado. O valor desta opção deve estar codificado em Base64 seguro para URL. Para mais informações, consulte Codificação de marca d'água. Nota
A opção o aceita variáveis no formato {varname} ou em combinações de strings e {varname}. Para mais informações, consulte Variáveis. |
|
b |
Nome do bucket onde salvar o objeto processado. O valor desta opção deve estar codificado em Base64 seguro para URL. Se esta opção não for especificada, o objeto processado será salvo no mesmo bucket do objeto de origem. Nota
A opção b aceita variáveis no formato {varname} ou em combinações de strings e {varname}. Para mais informações, consulte Variáveis. |
Usar SDKs do OSS
Especifique o parâmetro sys/saveas na requisição para salvar em um bucket específico o objeto processado com os SDKs do OSS. Os exemplos de código a seguir mostram como salvar o objeto processado usando SDKs do OSS nas linguagens de programação mais comuns. Para saber como salvar objetos processados com SDKs do OSS em outras linguagens, consulte Introdução.
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 {
// 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";
// Specify the ID of the region that maps to the endpoint. Example: cn-hangzhou.
String region = "cn-hangzhou";
// 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.
// Call the shutdown method to release resources when the OSSClient is no longer in use.
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 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.
target_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;
}
Usar a API RESTful
Se o seu negócio exige alto nível de personalização, chame diretamente as APIs RESTful do OSS e inclua o cálculo da assinatura no código.
Para processar uma imagem, chame a operação PostObject e passe x-oss-process no corpo da mensagem da requisição PostObject. Em seguida, especifique o parâmetro sys/saveas na requisição para salvar a imagem processada em um bucket específico. Para mais informações, consulte PostObject.
Os exemplos de código a seguir mostram como salvar um objeto processado em um bucket específico:
Usar parâmetros IMG para processar uma imagem e salvar o objeto processado em um bucket específico
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 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
Usar parâmetros de estilo para processar uma imagem e salvar o objeto processado em um bucket específico
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
// 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
Usar parâmetros de processamento para alterar o formato de um objeto e salvar o objeto processado em um bucket específico
Informações sobre os objetos de origem e de destino
-
Objeto de origem
Formato do objeto: DOCX
Nome do objeto de origem:
example.docx
-
Objeto de destino
Formato do objeto: PNG
Caminho de armazenamento:
oss://test-bucket/doc_images/
Exemplo de requisição
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
// 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
Usar parâmetros de estilo para processar um objeto e salvar o objeto processado em um bucket específico
Informações sobre os objetos de origem e de destino
-
Objeto de origem
Formato do objeto: DOCX
Nome do objeto de origem:
example.docx
-
Objeto de destino
Caminho de armazenamento:
oss://test-bucket/doc_images/
Exemplo de requisição
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
// 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
Usar parâmetros de processamento para transcodificar um vídeo e salvar o objeto processado em um bucket específico
Informações sobre os objetos de origem e de destino
-
Objeto de origem
Formato do vídeo: AVI
Nome do vídeo:
example.avi
-
Objeto de destino
-
Informações do vídeo
Formato do vídeo: MP4
Nome do vídeo:
outobjprefix.mp4Formato do stream de vídeo: H.265
Resolução do vídeo: 1920 × 1080
Taxa de quadros do vídeo: 30 fps
Bitrate do vídeo: 2 Mbit/s
-
Informações do áudio
Formato do stream de áudio: AAC
Bitrate do áudio: 100 Kbit/s
Stream de legendas: desativado
Caminho de armazenamento do vídeo:
oss://outbucket/outobj.mp4
-
Exemplo de requisição
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 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
Usar parâmetros de estilo para transcodificar um vídeo e salvar o objeto processado em um bucket específico
Informações sobre os objetos de origem e de destino
-
Objeto de origem
Formato do vídeo: AVI
Nome do vídeo:
example.avi
-
Objeto de destino
Formato do vídeo: MP4
Nome do vídeo:
outobjprefix.mp4Caminho de armazenamento do vídeo:
oss://outbucket/outobjprefix.mp4
Exemplo de requisição
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
// 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
Usar parâmetros de processamento para transformar um vídeo em sticker animado e salvar o objeto processado em um bucket específico
Informações sobre os objetos de origem e de destino
-
Objeto de origem
Nome do vídeo: example.mkv
-
Objeto de destino
-
Sticker animado
Formato: GIF
Intervalo do vídeo: 1s
Resolução: 100 x 100
-
Caminho de armazenamento do objeto
oss://outbucket/outobjprefix.gif
-
Exemplo de requisição
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
// 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
Usar parâmetros de estilo para transformar um vídeo em sticker animado e salvar o objeto processado em um bucket específico
Informações sobre os objetos de origem e de destino
-
Objeto de origem
Nome do vídeo: example.mkv
-
Sticker animado
Formato: GIF
-
Objeto de destino
-
Caminho de armazenamento do objeto
oss://outbucket/outobjprefix.gif
-
Exemplo de requisição
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
// 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
Usar parâmetros de processamento para capturar snapshots de sprite de um vídeo e salvar os snapshots de sprite em um bucket específico
Informações sobre os objetos de origem e de destino
-
Objeto de origem
Nome do vídeo: example.mkv
-
Objeto de destino
-
Snapshots de sprite
Formato: JPG
Intervalo de tempo para captura de snapshots de sprite: 10s
Resolução da subimagem: 100 x 100
Configurações do snapshot de sprite: 10 imagens por linha e 10 imagens por coluna. Preenchimento e margem definidos como 0.
-
Caminho de armazenamento do objeto
oss://outbucket/outobjprefix-%d.jpg
-
Exemplo de requisição
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
// 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
Usar parâmetros de estilo para capturar snapshots de sprite de um vídeo e salvar os snapshots de sprite em um bucket específico
Informações sobre os objetos de origem e de destino
-
Objeto de origem
Nome do vídeo: example.mkv
-
Objeto de destino
-
Snapshots de sprite
Formato: JPG
-
Caminho de armazenamento do objeto
oss://outbucket/outobjprefix-%d.jpg
-
Exemplo de requisição
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
// 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
Usar parâmetros de processamento para capturar snapshots de um vídeo e salvar os snapshots em um bucket específico
Informações sobre os objetos de origem e de destino
-
Objeto de origem
Nome do vídeo: example.mkv
-
Objeto de destino
-
Informações do snapshot
Formato: JPG
Intervalo de tempo para captura de snapshots: 10s
Resolução: 100 x 100
-
Caminho de armazenamento do objeto
oss://outbucket/outobjprefix-%d.jpg
-
Exemplo de requisição
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
// 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
Usar parâmetros de estilo para capturar snapshots de um vídeo e salvar os snapshots em um bucket específico
Informações sobre os objetos de origem e de destino
-
Objeto de origem
Nome do vídeo: example.mkv
-
Objeto de destino
-
Informações do snapshot
Formato: JPG
-
Caminho de armazenamento do objeto
oss://outbucket/outobjprefix-%d.jpg
-
Exemplo de requisição
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
// Use the examplestyle style to capture snapshots from the example.mkv object.
x-oss-async-process=style/examplestyle|sys/saveas,b_b3V0YnVja2V0,o_b3V0b2JqcHJlZml4LXtpbmRleH0ue2F1dG9leHR9Cg
Usar parâmetros de processamento para mesclar vídeos e salvar o vídeo mesclado em um bucket específico
Informações sobre os objetos de origem e de destino
-
Objetos de origem
Nomes dos vídeos: pre.mov, example.mkv, sur.mov
-
Método de mesclagem
-
Duração e sequência:
Nome do vídeo
Sequência
Duração
pre.mov
1
Vídeo inteiro
example.mkv
2
Do segundo 10 até o final do vídeo
sur.mov
3
Do início do vídeo até o segundo 10
-
-
Objeto de destino
-
Informações do vídeo
Formato do vídeo: h264
Taxa de quadros do vídeo: 25 fps
Bitrate do vídeo: 1 Mbit/s
-
Informações do áudio
Formato do áudio: AAC
Configurações de áudio: taxa de amostragem de 48 kHz e canais de som binaural
Bitrate do áudio: 96 Kbit/s
-
Caminho de armazenamento do objeto
oss://outbucket/outobjprefix.mp4
-
Exemplo de requisição
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
// 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
Usar parâmetros de processamento para transcodificar um objeto de áudio e salvar o objeto processado em um bucket específico
Informações sobre os objetos de origem e de destino
-
Objeto de origem
Formato do áudio: MP3
Nome do áudio: example.mp3
-
Método de tratamento
Duração da transcodificação: do milissegundo 1.000 ao milissegundo 60.000 do objeto de áudio
-
Objeto de destino
-
Informações do áudio
Formato do áudio: AAC
Configurações de áudio: manter a taxa de amostragem e os canais de som originais
Bitrate do áudio: 96 Kbit/s
-
Caminho de armazenamento do objeto
oss://outbucket/outobjprefix.aac
-
Exemplo de requisição
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
// 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
Usar parâmetros de estilo para transcodificar um objeto de áudio e salvar o objeto processado em um bucket específico
Informações sobre os objetos de origem e de destino
-
Objeto de origem
Formato do áudio: MP3
Nome do áudio: example.mp3
-
Objeto de destino
-
Informações do áudio
Formato do áudio: AAC
-
Caminho de armazenamento do objeto
oss://outbucket/outobjprefix.aac
-
Exemplo de requisição
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
// 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
Usar parâmetros de processamento para mesclar objetos de áudio e salvar o áudio mesclado em um bucket específico
Informações sobre os objetos de origem e de destino
-
Objetos de origem
Nomes dos áudios: pre1.mp3, pre2.wav, example.mp3, sur1.aac e sur2.wma
-
Método de mesclagem
-
Duração e sequência:
Nome do áudio
Sequência
Duração
pre1.mp3
1
Objeto de áudio inteiro
pre2.wav
2
Primeiros 2 segundos
example.mp3
3
Objeto de áudio inteiro
sur1.aac
4
Do segundo 4 ao segundo 10
sur2.wma
5
Do segundo 10 até o final do objeto de áudio
-
-
Objeto de destino
-
Informações do áudio
Formato do áudio: AAC
Configurações de áudio: taxa de amostragem de 48 kHz e canal de som mono
Bitrate do áudio: 96 Kbit/s
-
Caminho de armazenamento do objeto
oss://outbucket/outobjprefix.aac
-
Exemplo de requisição
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
// 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