The short video SDK for Android is an open source player component that is developed by Alibaba Cloud. The short video SDK for Android provides powerful features for video playback, including video recording, duet recording, and video merging.
Version information
public class Version {
public static final String VERSION = "";
public static final String BUILD_ID = "";
public static final String SRC_COMMIT_ID = "";
public static final String ALIVC_COMMIT_ID = "";
public static final String ANDROID_COMMIT_ID = "";
}
License
Video resolution
Resolution | 1:1 | 3:4 | 9:16 |
---|---|---|---|
480P | 480*480 | 480*640 | 480*848 |
540P | 540*540 | 540*720 | 540*960 |
720P | 720*720 | 720*960 | 720*1280 |
1080P | 1080*1080 | 1080*1440 | 1080*1920 |
- Recording module
You can use the setMediaInfo(MediaInfo mediaInfo) method of AliyunIRecorder to set a resolution for the recorded video by setting the videoWidth and videoHeight attributes of a MediaInfo object.
- Cropping module
You can use the setCropParam(CropParam param) method of AliyunICrop to set a resolution for the output video by setting the outputWidth and outputHeight attributes of a CropParam object.
- Editing module
You can use the setVideoParam(AliyunVideoParam param) method of AliyunIImport to set a resolution for the output video by setting the mOutputWidth and mOutputHeight attributes of an AliyunVideoParam object.
Video rotation angle
A video file may contain the rotation angle information. The short video SDK allows you to set a rotation angle for the recorded video. When you record a video in landscape mode, you can use the setRotation(int rotation) method of AliyunIRecorder to set the rotation angle of the camera. Then, the recorded video contains the rotation angle information.
Bitrate
Resolution | Recommended bitrate |
---|---|
480P | 1000000~2000000 |
540P | 2000000~3000000 |
720P | 2000000~4000000 |
1080P | 2000000~6000000 |
- Recording module
You can use the setVideoBitrate(int bitrate) method of AliyunIRecorder to set a bitrate for the recorded video.
- Cropping module
You can use the setCropParam(CropParam param) method of AliyunICrop to set a bitrate for the output video by setting the mVideoBitrate attribute of a CropParam object.
- Editing module
You can use the setVideoParam(AliyunVideoParam param) method of AliyunIImport to set a bitrate for the output video by setting the mBitrate attribute of an AliyunVideoParam object.
Frame rate
- Recording module
You can use the setMediaInfo(MediaInfo mediaInfo) method of AliyunIRecorder to set a frame rate for the recorded video by setting the mEncoderFps attribute of a MediaInfo object.
- Cropping module
You can use the setCropParam(CropParam param) method of AliyunICrop to set a frame rate for the output video by setting the frameRate attribute of a CropParam object.
- Editing module
You can use the setVideoParam(AliyunVideoParam param) method of AliyunIImport to set a frame rate for the output video by setting the mFrameRate attribute of an AliyunVideoParam object.
Keyframe
Frame is the basic unit of video images. A video file is composed of multiple consecutive frames. A keyframe is also called an I-frame. The key frame is important for interframe compression and encoding. During decoding, a complete image can be reconstructed with only a keyframe. Keyframes can be generated without referencing other images. A keyframe can be used as an image and a reference point for seeking.
GOP
- Recording module
You can use the setGop(int gop) method of AliyunIRecorder to set a GOP size for the recorded video.
- Cropping module
You can use the setCropParam(CropParam param) method of AliyunICrop to set a GOP size for the output video by setting the gop attribute of a CropParam object.
- Editing module
You can use the setVideoParam(AliyunVideoParam param) method of AliyunIImport to set a GOP size for the output video by setting the mGop attribute of an AliyunVideoParam object.
Scaling mode
If the aspect ratio of a material, such as an image or a video, is different from that of the output video, you must select a scaling mode.
Scaling mode | Solution |
---|---|
Cropping mode | Maintains the original aspect ratio and crops the material to display only the content in the middle area. |
Padding mode | Maintains the original aspect ratio and displays the complete material by filling the blank area with a specified color. |
- Cropping module
You can use the setCropParam(CropParam param) method of AliyunICrop to set a scaling mode for the output video by setting the mScaleMode attribute of a CropParam object.
- Editing module
You can use the setVideoParam(AliyunVideoParam param) method of AliyunIImport to set a scaling mode for the output video by setting the mScaleMode attribute of an AliyunVideoParam object.
Encoding mode
Encoding mode | Description |
---|---|
Software encoding | Software encoding is completed by using the CPU. Compared with hardware encoding, software encoding allows you to set more parameters. At the same bitrate, a software-encoded video is clearer. However, software encoding is slow, the CPU load is high, and the mobile phone gets hot. |
Hardware encoding | Hardware encoding is completed by other hardware instead of the CPU. Hardware encoding is faster, and the CPU load is low. However, the clearness of a hardware-encoded video is slightly lower than that of a software-encoded video. In addition, hardware encoding may fail on some Android devices. |
Resources
Supported formats
Type | Format |
---|---|
Video | MP4, MOV, and FLV |
Audio | MP3, AAC, and PCM |
Image | JPG, PNG, and GIF |