VAS_VOD Transmuxing

Last update:2022-04-13 09:24:28

1 VAS Intro

1.1 Brief Introduction

Currently, the commonly used video encapsulation formats include FLV, MP4, HLS, Dash, etc. With each has its own unique features, these formats are applied in different business scenarios:

  • FLV has a simple structure, a relatively small head, and a short video startup time. It is often used on PC terminals, but not supported by the Android or iOS native players;
  • MP4 has a complicated structure, a relatively large head, and a long video startup time However, with a good compatibility, MP4 is perfectly supported by Flash, Android, iOS, and even HTML5;
  • HLS and Dash support bitrate adaptation, thereby are focused and used by more and more video providers.
    • HLS(HTTP Live Streaming)protocol is implemented by Apple Inc. The video file is encapsulated into MPEG-2 chunks, each of which is kept on the server independently, and an m3u8 index file is created for the references of the segment list and segment information.
    • DASH(Dynamic Adaptive Streaming over HTTP)protocol is produced by MPEG. Similar to HLS, DASH divides the transport content into small files, and the file content can be kept in different bitrates. Seamless switching between these files in various bitrates will be implemented through key frame matching under different network environments, and thus the stuttering and buffering will be mitigated. DASH uses Media Presentation Description (MPD), which is a xml file similar to m3u8, to describe the files.
      In order to help customers reduce their technical investment and adapt to different application scenarios, CDNetworks has rolled out VoD Transmuxing function that supports any input and output of video encapsulation formats such as FLV, MP4, HLS and Dash.

1.2 Applicable Product Line

  • Media Acceleration

1.3 Application Scenarios

  • Convert MP4 to FLV to optimize video startup time;
  • Convert FLV to MP4 to improve platform compatibility;
  • Convert MP4 and FLV to HLS or Dash to support bitrate adaptation;
  • Other scenarios where multi-terminal and multi-platform adaptation can only be achieved by encapsulation format conversion;
  • Scenarios where separating the audio from video is needed. Such as lip sync, mimicry, voice-over in UGC scenario, audio playback in weak network, etc.

2 VAS Detail

Transmuxing is a processing method that packages the encoded and compressed video and audio tracks into a complete multimedia file according to a certain format.

  • Different packaging formats correspond to different encapsulation formats. Different encapsulation formats generally have different file suffixes.
  • Transmuxing only changes the data packaging format, and does not involve encoding and decoding operations.
  • Support de-encapsulating the audio track from the multimedia file and saving it as a single file for users to access.

CDNetworks supports mutual conversion between commonly used video encapsulation formats, such as:

  • Video formats: FLV, MP4, Dash, TS, MKV, MOV, WMV, AVI, VP8, VP9, RealVideo, Windows Media Video, etc.
  • Audio formats: AAC, AC-3, MP1, MP2, MP3, PCM, RealAudio, Windows Media Audio (WMA), OGG, etc.
  • Video encoding formats: H.265, H.264, H.263, MPEG, etc.

For video or audio formats which cannot be recognized by cloud transcoding, transmuxing will fail. Customer will receive the notification of transmuxing failure along with the failure cause.

2.1 Workflow

关于Flood Shield 旧报表下架通知(网络层和应用层DDoS概览)

Figure 1 Video Transmuxing Workflow

(1) Customer calls the cloud storage API to upload the video file and assigns a transmuxing instruction;
(2) After receiving the task, the cloud storage assembles the transmuxing instruction and assigns the instruction to the cloud transcoding;
(3) Cloud transcoding fetches the video file from the cloud storage for transmuxing operation, and uploads the processed video file to the cloud storage;
(4) Cloud storage notifies the customer of the target video address through API callback;
(5)(6)(7)(8) For the customer adopting CDN acceleration service, their users will utilize the video address that the cloud storage sends to customer, to interact with CDN PoPs.
Note: Cloud transcoding is a dedicated system platform for video file processing developed by CDNetworks.

2.2 Instructions

Support any input of video encapsulation formats such as FLV, MP4, Dash and HLS, and any output formats, as long as the output parameters specify the format.

Table 1 Video Transmuxing Parameters
Parameter Required Description
<op> Yes avthumb (operation type-video processing)
<format> Yes Target output format, such as mp4, flv, m3u8 and mpd.
/vn/<VideoNo> No Whether to remove the video stream, 0 is preserve and 1 is remove. The default value is 0.
/an/<VideoNo> No Whether to remove the audio stream, 0 is preserve and 1 is remove. The default value is 0.
Segment parameter
/segtime/<SegSeconds> No It is used to define the playback duration of each audio/video stream. Unit: second, and the value is a integer ranging from 1 to 120. Note: the below is the value adoption specification when the parameter is not set:
  1. When the input is a non-m3u8/mpd format, the default is 10 seconds;
  2. When the input is the m3u8/mpd format, and the transcoding parameter is not set, only text processing is made for the index file;
  3. When the input is the m3u8/mpd format, and the transcoding parameter is set, the segment duration will be calculated automatically
1. Specific parameter of HLS segment
/fastStartSeg/<FastStartSeg> No N second(s) is the duration of first M pieces of ts segments when slicing into m3u8 segments, and the parameter format is MxNs. For example:5x3s means that the slice length of the first 5 ts segments are 3 seconds.
2. Specific parameter of DASH segment
/segtype/<segtype> No Generated DASH file format, such as mp4 or m4s, and the default is m4s.
Note: To output multiple video encapsulation formats, customer needs to call API for multiple times.

2.3 Usage Example(take DASH segmentation as an example)

Take DASH segmentation as an example, and the transmuxing of mp4, flv and HLS can be processed with a similar method.
Make the DASH segments from lixm-test.mp4 video under the space of vod-wcs-test001, and rename mpd as lixm-test_file.mpd.

(1) Step 1:Obtain AK and SK from CDNetworks SI.

关于Flood Shield 旧报表下架通知(网络层和应用层DDoS概览)

关于Flood Shield 旧报表下架通知(网络层和应用层DDoS概览)

(2) Step 2: HLS segment path is /fops.

(3) Step 3:request content body is
Before encryption:

bucket=Urlsafe_Base64_Encode(vod-wcs-test001)&key=Urlsafe_Base64_Encode(lixm-test.mp4)&fops=Urlsafe_Base64_Encode(avthumb/mpd|saveas/Urlsafe_Base64_Encode(vod-wcs-test001:lixm-test_file.mpd))&force=1&separate=1

After encryption:

bucket=dm9kLXdjcy10ZXN0MDAx&key=bGl4bS10ZXN0Lm1wNA==&fops=YXZ0aHVtYi9tcGR8c2F2ZWFzL2RtOWtMWGRqY3kxMFpYTjBNREF4T214cGVHMHRkR1Z6ZEY5bWFXeGxMbTF3WkE9PQ==&force=1&separate=1

(4) Step 4: Utilize AK, SK, path and Body to generate the access token Authorization.
and mgrAuthorization_A:mgrAuthorization_B represents the access token in this example.
(5) Step 5: Obtain management domain from CDNetworks SI and it is replaced by mgrDomain in this example.
(6) Step 6: Execute command

curl -v -X POST -d “bucket=dm9kLXdjcy10ZXN0MDAx&key=bGl4bS10ZXN0Lm1wNA==&fops=YXZ0aHVtYi9tcGR8c2F2ZWFzL2RtOWtMWGRqY3kxMFpYTjBNREF4T214cGVHMHRkR1Z6ZEY5bWFXeGxMbTF3WkE9PQ==&force=1&separate=1” -H “Authorization:mgrAuthorization_A:mgrAuthorization_B” --url “http://mgrDomain/fops”

Lastly, check the vod-wcs-test001 space for the mpd and m4s file generated.

关于Flood Shield 旧报表下架通知(网络层和应用层DDoS概览)

Figure 2 Result of DASH segmentation command execution

3 Notices

(1) VoD Transmuxing is a value-added service and will be charged separately for usage.

(2) Video processing-related features can only manipulate video files stored on media cloud storage, so media cloud storage service should be enabled as well.

(3) Billing mode:

a) Video transmuxing is charged according to the total playback time of the video files to be processed (unit: minute/month);

b) The prices of video transmuxing and transcoding are different. If the transcoding parameter is configured as well when setting transmuxing, then customers will be charged the transcoding price (unit: minute/month);

c) Media Cloud storage is charged according to the monthly storage peak (unit: GB/month).

Is the content of this document helpful to you?
Yes
I have suggestion
Submitted successfully! Thank you very much for your feedback, we will continue to strive to do better!