Video/Audio Splicing

更新时间:2024-01-09 15:20:43

Splicing allows the combination of various video and audio clips to generate a unique output. The process can be employed simultaneously with other media processing operations.

How to Use

Structure your fops in the request body as follows:

<op>/<Format>
    /mode/<value>
    /concatorder/<value>
    /moovToFront/<value>
    /<encodeUrl1>/<encodeUrl2>...
    |saveas/<Urlsafe_Base64_Encode(bucket:filekey)>

Video/Audio Splicing Parameters

Parameter Required Description
op Yes Operation type. For media video/audio processing, set the operation type to avthumb.
format Yes Target format for output, such as mp3, mp4, m3u8, etc.
mode No This signifies the type of merging operation being performed and can have a value of either 1 or 2:
1: This is employed when the codecs in the files being merged are identical. You should set the mode to 1 when splicing audio files.
2: This is used when the codecs differ between the files being merged.
concatorder No This designates the sequence in which files are spliced, denoted with a hyphen in between. For instance, 2-1-4-3 signifies the order in which four files should be concatenated.
moovToFront No The moov atom in MP4 files contains essential metadata. This parameter specifies whether to place the moov atom at the beginning for improved playback performance, especially for streaming.
0 (default): Keep metadata at the end (as usual).
1: Move metadata to the beginning for faster startup.
<encodeUrl1>/<encodeUrl2>… Yes To designate the files for concatenation. The name of each file to be concatenated should be encoded in URL-safe Base64, with each encoded file name separated by a /. For example:
Urlsafe_Base64_Encode (test_1.mp4)/Urlsafe_Base64_Encode (test_2.mp4)
Please note that all files should come from the same bucket on Object Storage. Also, the system supports the concatenation of up to 5 files at a time.
saveas No This parameter defines the output location and filename as a URL-safe Base64-encoded string with the pseudocode Urlsafe_Base64_Encode(bucket:savedfilename).

Request Example

This example showcases the process of merging two videos, specifically named test_1.mp4 and test_2.mp4, located in the selected bucket vod-wcs-test001. The final output is a single video named test_merge.mp4.
Pseudocode format for the request:

curl -v -X POST 
–d "bucket=Urlsafe_Base64_Encode(vod-wcs-test001)&key=Urlsafe_Base64_Encode(test_1.mp4)&fops=Urlsafe_Base64_Encode(avconcat/mp4/mode/1/Urlsafe_Base64_Encode (test_1.mp4)/Urlsafe_Base64_Encode (test_2.mp4)|saveas/Urlsafe_Base64_Encode (vod-wcs-test001:test_merge.mp4))&force=1&separate=1" 
–H "Authorization:AccessKey:EncodeSign" 
--url "http://mgrDomain/fops""

Actual request format:

-curl -v -X POST 
-d "bucket=dm9kLXdjcy10ZXN0MDAx&key=dGVzdF8xLm1wNA==&fops=YXZjb25jYXQvbXA0L21vZGUvMS9kR1Z6ZEY4eUxtMXdOQT09fHNhdmVhcy9kbTlrTFhkamN5MTBaWE4wTURBeE9uUmxjM1JmYldWeVoyVXViWEEw&force=1&separate=1" 
-H "Authorization:AccessKey:EncodeSign" 
--url "http://mgrDomain/fops""
本篇文档内容对您是否有帮助?
有帮助
我要反馈
提交成功!非常感谢您的反馈,我们会继续努力做到更好!