Cette rubrique présente le concept, les consignes d'utilisation et la description des paramètres du paramètre sys/saveas, ainsi que des exemples d'utilisation.
Qu'est-ce que sys/saveas ?
Par défaut, un objet traité de manière synchrone n'est pas enregistré. Vous devez spécifier le paramètre sys/saveas dans une requête pour enregistrer l'objet traité dans un bucket spécifique. Le traitement asynchrone s'effectue sous forme de tâche : seule l'ID de la tâche est renvoyée. Par conséquent, vous devez spécifier le paramètre sys/saveas dans la requête avant son envoi. L'objet traité est alors enregistré dans un bucket spécifique pour un accès ultérieur.
Notes d'utilisation
-
Autorisations requises :
Pour enregistrer un objet traité, vous devez disposer de l'autorisation
oss:PostProcessTasksur le bucket source contenant l'objet source, et de l'autorisationoss:PutObjectsur l'objet traité.La liste de contrôle d'accès (ACL) d'un objet traité est identique à celle du bucket de destination et ne peut pas être modifiée.
Exigences relatives aux régions : Vous pouvez enregistrer l'objet traité dans le même bucket que l'objet source ou dans un bucket différent. Toutefois, le bucket source et le bucket de destination doivent appartenir au même compte Alibaba Cloud et se trouver dans la même région.
Méthode de stockage : Vous ne pouvez pas enregistrer directement dans un bucket spécifique les objets traités via des URL d'objet. Enregistrez-les d'abord sur votre ordinateur local, puis téléchargez-les vers le bucket de destination.
Durée de stockage des objets traités : Pour définir une durée de conservation spécifique, configurez une règle de cycle de vie indiquant la date d'expiration de l'objet. Pour plus d'informations, consultez Présentation.
Description des paramètres
Si vous spécifiez le paramètre sys/saveas dans une requête, vous devez renseigner les options décrites dans le tableau suivant.
Option | Description |
o | Nom de l'objet traité. La valeur de cette option doit être encodée en Base64 URL-safe. Pour plus d'informations, consultez Encodage du filigrane. Remarque L'option o prend en charge les variables. Les variables sont au format {varname} ou combinent des chaînes et {varname}. Pour plus d'informations, consultez Variables. |
b | Nom du bucket de destination de l'objet traité. La valeur de cette option doit être encodée en Base64 URL-safe. Si cette option n'est pas spécifiée, l'objet traité est enregistré dans le bucket source. Remarque L'option b prend en charge les variables. Les variables sont au format {varname} ou combinent des chaînes et {varname}. Pour plus d'informations, consultez Variables. |
Utiliser les SDK OSS
Spécifiez le paramètre sys/saveas dans une requête pour enregistrer l'objet traité via les SDK OSS dans un bucket spécifique. L'exemple de code suivant montre comment enregistrer le résultat du traitement d'image avec les SDK OSS pour les langages de programmation courants. Pour les autres langages, consultez Présentation.
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 × 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(target_bucket_name))))
result = bucket.process_object(source_image_name, process)
print(result)package main
import (
"encoding/base64"
"fmt"
"os"
"github.com/aliyun/aliyun-oss-go-sdk/oss"
)
// HandleError handles an error: it prints the error and exits.
func HandleError(err error) {
fmt.Println("Error:", err)
os.Exit(-1)
}
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 × 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 × 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;
}Utiliser l'API RESTful
Si votre activité nécessite un niveau élevé de personnalisation, appelez directement les API RESTful OSS. Vous devez alors inclure le calcul de la signature dans votre code.
Pour traiter une image, appelez l'opération PostObject et transmettez x-oss-process dans le corps de la requête. Spécifiez ensuite le paramètre sys/saveas pour enregistrer l'image traitée dans un bucket spécifique. Pour plus d'informations, consultez PostObject.
L'exemple de code suivant montre comment enregistrer un objet traité dans un bucket spécifique :
Utiliser des paramètres de traitement pour traiter une image et enregistrer l'objet traité dans un bucket spécifique
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
Utiliser des paramètres de style pour traiter une image et enregistrer l'objet traité dans un bucket spécifique
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
Utiliser des paramètres de traitement pour convertir un document et enregistrer l'objet traité dans un bucket spécifique
Informations sur les objets source et de destination
-
Objet source
Format de l'objet : DOCX
Nom de l'objet source :
example.docx
-
Objet de destination
Format de l'objet : PNG
Chemin de stockage :
oss://test-bucket/doc_images/
Exemple de requête
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
Utiliser des paramètres de style pour convertir un document et enregistrer l'objet traité dans un bucket spécifique
Informations sur les objets source et de destination
-
Objet source
Format de l'objet : DOCX
Nom de l'objet source :
example.docx
-
Objet de destination
Chemin de stockage :
oss://test-bucket/doc_images/
Exemple de requête
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
Utiliser des paramètres de traitement pour transcoder une vidéo et enregistrer l'objet traité dans un bucket spécifique
Informations sur les objets source et de destination
-
Objet source
Format vidéo : AVI
Nom de la vidéo :
example.avi
-
Objet de destination
-
Informations vidéo
Format vidéo : MP4
Nom de la vidéo :
outobjprefix.mp4Format du flux vidéo : H.265
Résolution vidéo : 1920 × 1080
Fréquence d'images vidéo : 30 ips
Débit binaire vidéo : 2 Mbit/s
-
Informations audio
Format du flux audio : AAC
Débit binaire audio : 100 Kbit/s
Flux de sous-titres : désactivé
Chemin de stockage de la vidéo :
oss://outbucket/outobj.mp4
-
Exemple de requête
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 × 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
Utiliser des paramètres de style pour transcoder une vidéo et enregistrer l'objet traité dans un bucket spécifique
Informations sur les objets source et de destination
-
Objet source
Format vidéo : AVI
Nom de la vidéo :
example.avi
-
Objet de destination
Format vidéo : MP4
Nom de la vidéo :
outobjprefix.mp4Chemin de stockage de la vidéo :
oss://outbucket/outobjprefix.mp4
Exemple de requête
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
Utiliser des paramètres de traitement pour transformer une vidéo en autocollant animé et enregistrer l'objet traité dans un bucket spécifique
Informations sur les objets source et de destination
-
Objet source
Nom de la vidéo : example.mkv
-
Objet de destination
-
Autocollant animé
Format : GIF
Intervalle vidéo : 1 s
Résolution : 100 × 100
-
Chemin de stockage de l'objet
oss://outbucket/outobjprefix.gif
-
Exemple de requête
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 × 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
Utiliser des paramètres de style pour transformer une vidéo en autocollant animé et enregistrer l'objet traité dans un bucket spécifique
Informations sur les objets source et de destination
-
Objet source
Nom de la vidéo : example.mkv
-
Autocollant animé
Format : GIF
-
Objet de destination
-
Chemin de stockage de l'objet
oss://outbucket/outobjprefix.gif
-
Exemple de requête
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
Utiliser des paramètres de traitement pour capturer des instantanés sprite à partir d'une vidéo et enregistrer les instantanés sprite dans un bucket spécifique
Informations sur les objets source et de destination
-
Objet source
Nom de la vidéo : example.mkv
-
Objet de destination
-
Instantanés sprite
Format : JPG
Intervalle de temps pour la capture des instantanés sprite : 10 s
Résolution de la sous-image : 100 × 100
Configurations des instantanés sprite : 10 images par ligne. 10 images par colonne. Le remplissage et la marge sont tous deux de 0.
-
Chemin de stockage de l'objet
oss://outbucket/outobjprefix-%d.jpg
-
Exemple de requête
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
Utiliser des paramètres de style pour capturer des instantanés sprite à partir d'une vidéo et enregistrer les instantanés sprite dans un bucket spécifique
Informations sur les objets source et de destination
-
Objet source
Nom de la vidéo : example.mkv
-
Objet de destination
-
Instantanés sprite
Format : JPG
-
Chemin de stockage de l'objet
oss://outbucket/outobjprefix-%d.jpg
-
Exemple de requête
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
Utiliser des paramètres de traitement pour capturer des instantanés à partir d'une vidéo et enregistrer les instantanés dans un bucket spécifique
Informations sur les objets source et de destination
-
Objet source
Nom de la vidéo : example.mkv
-
Objet de destination
-
Informations sur l'instantané
Format : JPG
Intervalle de temps pour la capture des instantanés : 10 s
Résolution : 100 × 100
-
Chemin de stockage de l'objet
oss://outbucket/outobjprefix-%d.jpg
-
Exemple de requête
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 video 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
Utiliser des paramètres de style pour capturer des instantanés à partir d'une vidéo et enregistrer les instantanés dans un bucket spécifique
Informations sur les objets source et de destination
-
Objet source
Nom de la vidéo : example.mkv
-
Objet de destination
-
Informations sur l'instantané
Format : JPG
-
Chemin de stockage de l'objet
oss://outbucket/outobjprefix-%d.jpg
-
Exemple de requête
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 video snapshots from the example.mkv object.
x-oss-async-process=style/examplestyle|sys/saveas,b_b3V0YnVja2V0,o_b3V0b2JqcHJlZml4LXtpbmRleH0ue2F1dG9leHR9Cg
Utiliser des paramètres de traitement pour fusionner des vidéos et enregistrer la vidéo fusionnée dans un bucket spécifique
Informations sur les objets source et de destination
-
Objets source
Noms des vidéos : pre.mov, example.mkv, sur.mov
-
Méthode de fusion
-
Durée et séquence :
Nom de la vidéo
Séquence
Durée
pre.mov
1
Vidéo entière
example.mkv
2
De la 10e seconde à la fin de la vidéo
sur.mov
3
Du début de la vidéo à la 10e seconde
-
-
Objet de destination
-
Informations vidéo
Format vidéo : h264
Fréquence d'images vidéo : 25 ips
Débit binaire vidéo : 1 Mbit/s
-
Informations audio
Format audio : AAC
Configurations audio : fréquence d'échantillonnage de 48 kHz et canaux stéréo
Débit binaire audio : 96 Kbit/s
-
Chemin de stockage de l'objet
oss://outbucket/outobjprefix.mp4
-
Exemple de requête
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
Utiliser des paramètres de traitement pour transcoder un objet audio et enregistrer l'objet traité dans un bucket spécifique
Informations sur les objets source et de destination
-
Objet source
Format audio : MP3
Nom de l'audio : example.mp3
-
Méthode de traitement
Durée du transcodage : commence à la 1000e milliseconde de l'objet audio et dure 60 000 millisecondes
-
Objet de destination
-
Informations audio
Format audio : AAC
Configurations audio : conserver la fréquence d'échantillonnage et les canaux sonores d'origine
Débit binaire audio : 96 Kbit/s
-
Chemin de stockage de l'objet
oss://outbucket/outobjprefix.aac
-
Exemple de requête
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
Utiliser des paramètres de style pour transcoder un objet audio et enregistrer l'objet traité dans un bucket spécifique
Informations sur les objets source et de destination
-
Objet source
Format audio : MP3
Nom de l'audio : example.mp3
-
Objet de destination
-
Informations audio
Format audio : AAC
-
Chemin de stockage de l'objet
oss://outbucket/outobjprefix.aac
-
Exemple de requête
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
Utiliser des paramètres de traitement pour fusionner des objets audio et enregistrer l'audio fusionné dans un bucket spécifique
Informations sur les objets source et de destination
-
Objets source
Noms des fichiers audio : pre1.mp3, pre2.wav, example.mp3, sur1.aac et sur2.wma
-
Méthode de fusion
-
Durée et séquence :
Nom de l'audio
Séquence
Durée
pre1.mp3
1
Objet audio entier
pre2.wav
2
2 premières secondes
example.mp3
3
Objet audio entier
sur1.aac
4
De la 4e seconde à la 10e seconde
sur2.wma
5
De la 10e seconde à la fin de l'objet audio
-
-
Objet de destination
-
Informations audio
Format audio : AAC
Configurations audio : fréquence d'échantillonnage de 48 kHz et canal mono
Débit binaire audio : 96 Kbit/s
-
Chemin de stockage de l'objet
oss://outbucket/outobjprefix.aac
-
Exemple de requête
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