tencent cloud

Cloud Object Storage

Release Notes and Announcements
Release Notes
Announcements
Product Introduction
Overview
Features
Use Cases
Strengths
Concepts
Regions and Access Endpoints
Specifications and Limits
Service Regions and Service Providers
Billing
Billing Overview
Billing Method
Billable Items
Free Tier
Billing Examples
Viewing and Downloading Bill
Payment Overdue
FAQs
Getting Started
Console
Getting Started with COSBrowser
User Guide
Creating Request
Bucket
Object
Data Management
Batch Operation
Global Acceleration
Monitoring and Alarms
Operations Center
Data Processing
Content Moderation
Smart Toolbox
Data Processing Workflow
Application Integration
User Tools
Tool Overview
Installation and Configuration of Environment
COSBrowser
COSCLI (Beta)
COSCMD
COS Migration
FTP Server
Hadoop
COSDistCp
HDFS TO COS
GooseFS-Lite
Online Tools
Diagnostic Tool
Use Cases
Overview
Access Control and Permission Management
Performance Optimization
Accessing COS with AWS S3 SDK
Data Disaster Recovery and Backup
Domain Name Management Practice
Image Processing
Audio/Video Practices
Workflow
Direct Data Upload
Content Moderation
Data Security
Data Verification
Big Data Practice
COS Cost Optimization Solutions
Using COS in the Third-party Applications
Migration Guide
Migrating Local Data to COS
Migrating Data from Third-Party Cloud Storage Service to COS
Migrating Data from URL to COS
Migrating Data Within COS
Migrating Data Between HDFS and COS
Data Lake Storage
Cloud Native Datalake Storage
Metadata Accelerator
GooseFS
Data Processing
Data Processing Overview
Image Processing
Media Processing
Content Moderation
File Processing Service
File Preview
Troubleshooting
Obtaining RequestId
Slow Upload over Public Network
403 Error for COS Access
Resource Access Error
POST Object Common Exceptions
API Documentation
Introduction
Common Request Headers
Common Response Headers
Error Codes
Request Signature
Action List
Service APIs
Bucket APIs
Object APIs
Batch Operation APIs
Data Processing APIs
Job and Workflow
Content Moderation APIs
Cloud Antivirus API
SDK Documentation
SDK Overview
Preparations
Android SDK
C SDK
C++ SDK
.NET(C#) SDK
Flutter SDK
Go SDK
iOS SDK
Java SDK
JavaScript SDK
Node.js SDK
PHP SDK
Python SDK
React Native SDK
Mini Program SDK
Error Codes
Harmony SDK
Endpoint SDK Quality Optimization
Security and Compliance
Data Disaster Recovery
Data Security
Cloud Access Management
FAQs
Popular Questions
General
Billing
Domain Name Compliance Issues
Bucket Configuration
Domain Names and CDN
Object Operations
Logging and Monitoring
Permission Management
Data Processing
Data Security
Pre-signed URL Issues
SDKs
Tools
APIs
Agreements
Service Level Agreement
Privacy Policy
Data Processing And Security Agreement
Contact Us
Glossary

Concatenation Task APIs

PDF
Focus Mode
Font Size
Last updated: 2024-02-04 15:40:24

Overview

This document provides an overview of APIs and SDK code samples for submitting a splicing job.
API
Description
Submits a splicing job.

Submitting Splicing Job

Feature description

This API is used to submit a splicing job.

Method prototype

public Guzzle\\Service\\Resource\\Model createMediaConcatJobs(array $args = array());

Sample request

Sample 1. Using a template

<?php

require dirname(__FILE__) . '/../vendor/autoload.php';

$secretId = "SECRETID"; //Replace it with the actual `SecretId`, which can be viewed and managed in the CAM console at https://console.tencentcloud.com/cam/capi
$secretKey = "SECRETKEY"; //Replace it with the actual `SecretKey`, which can be viewed and managed in the CAM console at https://console.tencentcloud.com/cam/capi
$region = "ap-beijing"; // Replace it with the actual region, which can be viewed in the console at https://console.tencentcloud.com/cos5/bucket.
$cosClient = new Qcloud\\Cos\\Client(
array(
'region' => $region,
'schema' => 'https', // Protocol, which is `http` by default
'credentials'=> array(
'secretId' => $secretId ,
'secretKey' => $secretKey)));
try {
$result = $cosClient->createMediaConcatJobs(array(
'Bucket' => 'examplebucket-1250000000', // Bucket name in the format of `BucketName-Appid`, which can be viewed in the COS console at https://console.tencentcloud.com/cos5/bucket.
'Tag' => 'Concat',
'QueueId' => 'asdadadfafsdkjhfjghdfjg',
'CallBack' => 'https://example.com/callback',
'Input' => array(
'Object' => 'video01.mp4'
),
'Operation' => array(
'TemplateId' => 'asdfafiahfiushdfisdhfuis',
'Output' => array(
'Region' => $region,
'Bucket' => 'examplebucket-1250000000', // Bucket name in the format of `BucketName-Appid`, which can be viewed in the COS console at https://console.tencentcloud.com/cos5/bucket.
'Object' => 'concat-video02.mp4',
),
// 'UserData' => 'xxx', // The user information passed through.
// 'JobLevel' => '0', // Job priority. The greater the value, the higher the priority. Valid values: `0`, `1`, `2`. Default value: `0`.
),
));
// Request succeeded
print_r($result);
} catch (\\Exception $e) {
// Request failed
echo($e);
}

Sample 2. Customizing parameters

<?php

require dirname(__FILE__) . '/../vendor/autoload.php';

$secretId = "SECRETID"; //Replace it with the actual `SecretId`, which can be viewed and managed in the CAM console at https://console.tencentcloud.com/cam/capi
$secretKey = "SECRETKEY"; //Replace it with the actual `SecretKey`, which can be viewed and managed in the CAM console at https://console.tencentcloud.com/cam/capi
$region = "ap-beijing"; // Replace it with the actual region, which can be viewed in the console at https://console.tencentcloud.com/cos5/bucket.
$cosClient = new Qcloud\\Cos\\Client(
array(
'region' => $region,
'schema' => 'https', // Protocol, which is `http` by default
'credentials'=> array(
'secretId' => $secretId ,
'secretKey' => $secretKey)));
try {
$result = $cosClient->createMediaConcatJobs(array(
'Bucket' => 'examplebucket-1250000000', // Bucket name in the format of `BucketName-Appid`, which can be viewed in the COS console at https://console.tencentcloud.com/cos5/bucket.
'Tag' => 'Concat',
'QueueId' => 'asdadadfafsdkjhfjghdfjg',
'CallBack' => 'https://example.com/callback',
'Input' => array(
'Object' => 'video01.mp4'
),
'Operation' => array(
// 'UserData' => 'xxx', // The user information passed through.
// 'JobLevel' => '0', // Job priority. The greater the value, the higher the priority. Valid values: `0`, `1`, `2`. Default value: `0`.
'Output' => array(
'Region' => $region,
'Bucket' => 'examplebucket-1250000000', // Bucket name in the format of `BucketName-Appid`, which can be viewed in the COS console at https://console.tencentcloud.com/cos5/bucket.
'Object' => 'concat-video03.mp4',
),
'ConcatTemplate' => array(
'ConcatFragments' => array(
array(
'Url' => 'https://example.com/video01.mp4',
'Mode' => 'Start',
// 'StartTime' => '0',
// 'EndTime' => '7',
),
array(
'Url' => 'https://example.com/video02.mp4',
'Mode' => 'Start',
// 'StartTime' => '0',
// 'EndTime' => '10',
),
// ... repeated
),
'Index' => 1,
'Container' => array(
'Format' => 'mp4'
),
'Audio' => array(
'Codec' => 'mp3',
'Samplerate' => '',
'Bitrate' => '',
'Channels' => '',
),
'Video' => array(
'Codec' => 'H.264',
'Bitrate' => '1000',
'Width' => '1280',
'Height' => '',
'Fps' => '30',
),
),
),
));
// Request succeeded
print_r($result);
} catch (\\Exception $e) {
// Request failed
echo($e);
}

Parameter description

Request has the following sub-nodes:
Node Name (Keyword)
Parent Node
Description
Type
Required
Tag
Request
Job tag: Concat
String
Yes
Input
Request
Information of the media file to be processed
Container
No
Operation
Request
Operation rule
Container
Yes
QueueId
Request
Queue ID of the job
String
Yes
CallBackFormat
Request
Job callback format, which can be JSON or XML (default value). It takes priority over that of the queue.
String
No
CallBackType
Request
Job callback type, which can be Url (default value) or TDMQ. It takes priority over that of the queue.
String
No
CallBack
Request
Job callback address, which takes priority over that of the queue. If it is set to no, no callbacks will be generated at the callback address of the queue.
String
No
CallBackMqConfig
Request
TDMQ configuration for job callback as described in Structure, which is required if CallBackType is TDMQ.
Container
No
Input has the following sub-nodes:
Node Name (Keyword)
Parent Node
Description
Type
Required
Object
Request.Input
Media filename
String
Yes
Operation has the following sub-nodes:
Node Name (Keyword)
Parent Node
Description
Type
Required
ConcatTemplate
Request.Operation
Splicing parameter.
Container
No
TemplateId
Request.Operation
Template ID
String
No
Output
Request.Operation
Result output address
Container
Yes
JobLevel
Request.Operation
Job priority. The greater the value, the higher the priority. Valid values: 0, 1, 2. Default value: 0.
String
No
Note:
TemplateId is used first. If TemplateId is unavailable, ConcatTemplate is used.
ConcatTemplate has the following sub-nodes:
Node Name (Keyword)
Parent Node
Description
Type
Required
Default Value
Constraints
ConcatFragment
Request.Operation. ConcatTemplate
Splicing node
Container array
No
None
Multiple files can be spliced in sequence.
Audio
Request.Operation. ConcatTemplate
Audio parameter. Same as Request.ConcatTemplate.Audio in the splicing template creation API CreateMediaTemplate.
Container
No
None
None
Video
Request.Operation. ConcatTemplate
Video parameter. Same as Request.ConcatTemplate.Video in the splicing template creation API CreateMediaTemplate.
Container
No
None
None
Container
Request.Operation. ConcatTemplate
Container format. Same as Request.ConcatTemplate.Container in the splicing template creation API CreateMediaTemplate.
Container
Yes
None
None
AudioMix
Request.Operation. ConcatTemplate
Audio mix parameter as described in Structure.
Container array
No
None
Valid only if Audio.Remove is false
Index
Request.Operation. ConcatTemplate
Index of the Input node in the ConcatFragment sequence
String
No
0
The number of indexes configured cannot be greater than the number of fragments specified by ConcatFragment.
DirectConcat
Request.Operation. ConcatTemplate
Simple splicing (without transcoding). Other video and audio parameters become invalid.
String
No
false
true, false
ConcatFragment has the following sub-nodes:
Node Name (Keyword)
Parent Node
Description
Type
Required
Default Value
Constraints
Url
Request.Operation. ConcatTemplate. ConcatFragment
Splicing object address
String
Yes
None
Same as the address of the bucket object file.
FragmentIndex
Request.Operation. ConcatTemplate. ConcatFragment
Index position of the spliced object
String
No
0
An integer greater than or equal to 0
StartTime
Request.Operation. ConcatTemplate. ConcatFragment
Start time
String
No
Video start time
[0, video duration] seconds
EndTime
Request.Operation. ConcatTemplate. ConcatFragment
End time
String
No
Video end time
[0, video duration] seconds
Output has the following sub-nodes:
Node Name (Keyword)
Parent Node
Description
Type
Required
Region
Request.Operation.Output
Bucket region
String
Yes
Bucket
Request.Operation.Output
Result storage bucket
String
Yes
Object
Request.Operation.Output
Result file name
String
Yes

Sample response

GuzzleHttp\\Command\\Result Object
(
[Body] => GuzzleHttp\\Psr7\\Stream Object
(
[stream:GuzzleHttp\\Psr7\\Stream:private] => Resource id #88
[size:GuzzleHttp\\Psr7\\Stream:private] =>
[seekable:GuzzleHttp\\Psr7\\Stream:private] => 1
[readable:GuzzleHttp\\Psr7\\Stream:private] => 1
[writable:GuzzleHttp\\Psr7\\Stream:private] => 1
[uri:GuzzleHttp\\Psr7\\Stream:private] => php://temp
[customMetadata:GuzzleHttp\\Psr7\\Stream:private] => Array
(
)

)

[RequestId] => NjI2MjFhOTHASIUDHAUISDHl8yMjMxNmE=
[ContentType] => application/xml
[ContentLength] => 792
[Bucket] => examplebucket-1250000000
[Location] => examplebucket-1250000000.ci.ap-beijing.myqcloud.com/jobs
[Response] => Array
(
[JobsDetail] => Array
(
[Code] => Success
[CreationTime] => 2022-04-22T11:01:42+0800
[EndTime] => -
[Input] => Array
(
[BucketId] => examplebucket-1250000000
[Object] => video01.mp4
[Region] => ap-beijing
)

[JobId] => j898f573asd780a8sd90a8sd09e30cf31f
[Message] =>
[Operation] => Array
(
[Output] => Array
(
[Bucket] => examplebucket-1250000000
[Object] => concat-video01.mp4
[Region] => ap-beijing
)

[TemplateId] => t17b9c2e7a0s8d0a8d0a9d43552f648e
[TemplateName] => concat-1
[UserData] => xxx
[TemplateName] => 0
)

[QueueId] => p81e648af2aeas78d0a8d09a8d09757be086
[StartTime] => -
[State] => Submitted
[Tag] => Concat
)

)

)


Help and Support

Was this page helpful?

Help us improve! Rate your documentation experience in 5 mins.

Feedback