Import videos
Updated at:
Copy as MD
Import videos, images, and other media from local devices or the draft box by using the short video SDK.
Supported editions
| Edition | Supported |
| Professional | Yes |
| Standard | Yes |
| Basic | No |
Related classes
| Class | Description |
| AliyunIImport | Core video import class. Handles configuration file generation and resource release. |
| AliyunImportCreator | Factory class for obtaining import instances. |
| AliyunImageClip | Defines image properties such as width and height. |
| AliyunVideoClip | Defines video clip properties such as start time, end time, width, and height. |
| AliyunVideoParam | Defines video output parameters such as width, height, display mode, and scaling ratio. |
Import videos from local devices
Add video clips by using the AliyunIImport class to generate the URI of the video configuration file as the input parameter of the AliyunIEditor class.
// 1. Create an instance.
AliyunIImport importor = AliyunImportCreator.getImportInstance(context);
// 2.1 Add a video.
importor.addMediaClip(new AliyunVideoClip.Builder()
.source(filePath)
.startTime(startTime)
.endTime(startTime + duration)
.duration(duration)
.build());
// 2.2 Add an image.
importor.addMediaClip(new AliyunImageClip.Builder()
.source(filePath)
.duration(duration)
.build());
// 3. Configure output parameters.
AliyunVideoParam param = new AliyunVideoParam.Builder()
.frameRate(frameRate) // The frame rate.
.gop(gop) // gop
.crf(crf) // crf
.videoQuality(videoQuality) // The video quality.
.scaleMode(mScaleMode) // The scaling mode.
.outputWidth(outputWidth) // The output video width.
.outputHeight(outputHeight) // The output video height.
.videoCodec(videoCodec)
.build();
importor.setVideoParam(param);
// 4. Generate the configuration file of video sources.
// Generate the URI of the configuration file as the input parameter of AliyunIEditor.
String videoConfigPath = import.generateProjectConfigure();
// 5. Release the instance.
importor.release()
Import videos from the draft box
Use the URI of the draft box as the input parameter of the AliyunIEditor class to import videos. For more information, see Draft box.
Is this page helpful?