All Products
Search
Document Center

Best practices

Last Updated: Jul 11, 2019

Overview

This topic describes best practices related to media processing and the FAQs for your reference.

Transcoding template configuration

Video parameters

Disable Video

If you select this check box, the transcoded stream does not contain video information. Generally, you can select this check box to extract audio, for example, in the radio station scenario.

Bitrate and Resolution

The bitrate refers to the data traffic that video files use per unit time. It is the most important item for image quality control in video encoding. The bitrate is measured in bits per second (bit/s). The commonly used units are kbit/s and Mbit/s.Generally, the higher the bitrate of a video file at the same resolution, the smaller the compression ratio and the higher the image quality. The higher the bitrate, the higher the sample rate per unit time, the higher the data stream accuracy, the closer the processed file is to the original file, the better the image quality, the higher the video definition, and the higher the requirement on the decoding capability of the playback device.The resolution refers to the capability to distinguish details of a video. It is the number of pixels in each dimension. For example, 1280 × 720 means the width is 1280 pixels and the height is 720 pixels. The resolution determines the image detail fineness of a video. In general, a video with the higher resolution contains more pixels and has clearer images.The resolution is a main factor that determines the bitrate. Videos with different resolutions use different bitrates. In general, the higher the resolution of a video, the higher the required bitrate, but it is not always the case. Each resolution corresponds to a proper range of bitrates. The so-called “proper range” means that if the bitrate is below the lower limit of this range, the resolution is low and the video quality is poor. However, if the bitrate is higher than the upper limit of this range, the network traffic and storage space are wasted, while the video quality improves a little or even does not improve.

The following table describes the recommended bitrate and resolution for each definition.

Definition Recommended bitrate (kbit/s) Recommended resolution (pixels) Resolution range (pixels)
Low Definition 400 640 × 360 128 × 128 ~ 640 × 360
Standard Definition 900 960 × 540 641 × 361 ~ 960 × 540
High Definition 1500 1280 × 720 961 × 541 ~ 1280 × 720
Ultra-High Definition 3000 1920 × 1080 1281 × 721 ~ 1920 × 1080
2K 3500 2560 × 1440 1920 × 1080 ~ 2560 × 1440
4K 6000 2560 × 1440 2560 × 1440 ~ 3840 × 2160

Note:

  • The width and height of the resolution are optional. If only the width is set, the height is automatically set based on the aspect ratio of the video mezzanine file. If neither the width nor height is set, the width and height of the video mezzanine file are used.
  • The unit of the bitrate is kbit/s. The unit of the resolution (width × height) is pixel.

Frame Rate

The frame rate is used to measure the number of video display frames per unit time, that is, the number of frames of images refreshed per second. The unit is frame per second (FPS) or Hz.

A higher frame rate can achieve a smoother and more lifelike video. In general, 25~30 FPS is acceptable. When the frame rate increases to 60 FPS, the interaction and lifelikeness are significantly improved. However, frame rates over 75 FPS do not noticeably increase the smoothness. Using a frame rate higher than the refresh rate of your display is only a waste of graphic processing capability because the display is unable to refresh itself at that frame rate. The higher the frame rate at the same resolution, the higher the requirement on the processing capability of the graphics card.

  • In ApsaraVideo for VOD, the recommended frame rate is 25 FPS.

Maximum Keyframe Interval (the number of frames in a GOP)

A group of pictures (GOP) is a group of continuous pictures in an MPEG-encoded video or video stream. It starts with an I-frame and ends with the next I-frame. A GOP contains the following picture types:

  • I-frame (intra coded picture): the keyframe. An I-frame contains all the information needed to produce the picture for that frame. It is decoded independently of all other pictures. It can be regarded as a static picture. The first frame in the video sequence is always an I-frame, and each GOP starts with an I-frame.
  • P-frame (predictive coded picture): A P-frame must be encoded with reference to the preceding I-frame. A P-frame contains motion-compensated difference information relative to the previous frame (which may be an I-frame or a P-frame). During decoding, the difference defined by the current P-frame is superimposed with the previously cached picture to generate the final picture. Compared with I-frames, P-frames occupy fewer data bits. However, P-frames are sensitive to transmission errors because of their complex dependencies on the previous P and I reference frames.
  • B-frame (bidirectionally predictive coded picture): A B-frame contains motion-compensated difference information relative to the previous and subsequent frames. During decoding, the data of the current B-frame is superimposed with both the previously cached picture and the decoded subsequent picture to generate the final picture. B-frames provide a high compression ratio, but require high decoding performance.

The GOP value indicates the interval of keyframes, that is, the distance between two Instantaneous Decoding Refresh (IDR) frames or the maximum number of frames in a frame group. Generally, at least one keyframe is required for each second of video. Adding more keyframes improves video quality, but results in increased bandwidth consumption and higher network load. The GOP value (number of frames) divided by the frame rate is the interval.

  • In ApsaraVideo for VOD, the recommended GOP value and frame rate are 250 frames and 25 FPS, respectively. Therefore, the recommended interval is 10 seconds.

Audio parameters

Disable Audio

  • If you select this check box, the transcoded stream does not contain audio information. You can select this check box if you want to disable the audio in the video mezzanine file.

Sample Rate

The sample rate, or sample frequency, defines the number of samples that are extracted from continuous signals every second to form discrete signals. The unit is Hz. The sample rate refers to the sample frequency when analog signals are converted to digital signals, that is, the number of samples per unit time. The higher the sample rate, the more real and natural the sound.

  • In ApsaraVideo for VOD, the recommended sample rate is 44100 Hz.

Bitrate

Definition Recommended bitrate (kbit/s)
Standard Quality 128
High Quality 320

Note:

  • Valid values for the audio bitrate: 8-1000 kbit/s.

Audio Channels

  • In ApsaraVideo for VOD, the recommend number of audio channels is 2.

FAQ

  • How do I upload videos without transcoding?

    • To upload videos without transcoding, select the No Transcoding template. The No Transcoding template is a special transcoding template. When the No Transcoding template is used, uploaded videos are not transcoded. ApsaraVideo for VOD adds information about the video mezzanine files to the information list of video streams that can be played. You can obtain the playback URLs of the video mezzanine files from the playback information returned by the GetPlayInfo operation. The No Transcoding template is often used for uploading short videos or in scenarios where uploaded videos need to be played immediately after they are uploaded.
  • How do I automatically scale the resolution of transcoded streams based on the aspect ratio of the video mezzanine file?

    • When configuring the transcoding template, set only the width or height of the target resolution. Then, the other resolution parameter is automatically set based on the aspect ratio of the video mezzanine file.
  • How to I generate an audio-only stream during transcoding?

    • Method 1: Add a template, set the container format to MP4 or HLS, and select the Disable Video check box.
    • Method 2: Add a template and set the container format to MP3.
  • How do I use conditional transcoding?

    • Conditional transcoding is often configured when you want to generate streams in higher definitions. For example, you set the definition to 4K, but the bitrate (or resolution) of the uploaded video is lower than that specified in the transcoding template. In this case, you can configure conditional transcoding to process the video in either of the following ways:
      • Do not transcode the video in the specified specifications.
      • Transcode the video based on the bitrate (or resolution) of the video mezzanine file.

Snapshot template configuration

Normal snapshot

Set normal snapshot parameters as needed. For more information, see SnapshotConfig. If the width and height of snapshots must be the same as those of the video mezzanine file, we recommend that you do not set the Width and Height parameters.

Sprite snapshot

Set sprite snapshot parameters as needed. For more information, see SpriteSnapshotConfig. Unless otherwise required, we recommend that you set the KeepCellPic parameter to delete. In this way, the small images that compose a sprite snapshot are deleted after the sprite snapshot is generated.

Watermark configuration

Image watermark

To ensure that image watermarks are displayed clearly at different video resolutions, we recommend that you set the Width, Height, Dx, and Dy parameters to image proportion values. For more information, see Video watermark.

Text watermark

For more information about the parameters of a text watermark, see Text watermark. Except for the text watermark content, use the default values of other parameters unless otherwise required.