HMS-Core / hms-video-editor-demo

HUAWEI Video Editor Kit provides full video editing functions like video import/export, editing and rendering. This sample code is used to describe how to integrate the Video Editor Kit SDK.
Apache License 2.0
85 stars 27 forks source link
hms huawei java video video-editor

HUAWEI Video Editor Kit Sample

English | 中文

Table of Contents

Introduction

Huawei Video Editor Kit (Video Editor Kit) provided by Huawei to quickly build video editing capabilities. It provides two integration modes.

Both modes provide one-stop video editing capabilities, such as import, editing, rendering, export, and media resource management. These two modes provide high-performance, easy-to-use, and highly compatible interfaces, helping you easily build applications.

Project directory structure

|-- com.huawei.videoeditorkit.videoeditdemo
    |--sdkdemo  atomic capability SDK demo
    |--uidemo   UI SDk demo
    |--screenrecorddemo  Screen Recorder SDK Demo
    |--templatetooldemo  Template Creation SDK Demo

Running Procedure

Note:

The package name in this project cannot be used to apply for agconnect-services.json. You can use a customized package name to apply for agconnect-services.json. You only need to change applicationId in application-level build.gradle to the same package name as the applied agconnect-services.json to experience Video Editor Kit services.

Supported Environment

Android SDK 24 or later and JDK 1.8 or later are recommended.

Question or issues

If you want to evaluate more about HMS Core, r/HMSCore on Reddit is for you to keep up with latest news about HMS Core, and to exchange insights with other developers.

If you have questions about how to use HMS samples, try the following options:

If you run into a bug in our samples, please submit an issue to the Repository. Even better you can submit a Pull Request with a fix.

License

This sample code has obtained Apache 2.0 license.

Code indexes for key functions

|-- HomeActivity: App home page, which can be redirected to the video creation page (MainActivity) and the open, independent AI capabilities.
    |-- Entries to AI capabilities on the home screen:
        |-- faceReenact(String imagePath): moving picture
        |-- faceSmile(String imagePath): auto-smile
        |-- aiColor(String filePath): AI color
        |-- timeLapse(String imagePath): auto-timelapse
        |-- videoSelection(String videoPath): highlight
        |-- objectSeg(String photoPath): object segmentation
        |-- headSeg(String photoPath): head segmentation
        |-- Color hair. **HairDyeingFragment** is launched. After a hair color is selected and successfully downloaded, **hairDyeing(Bitmap colormapBitmap)** is called for processing.
        |-- Beauty. **CameraActivity** and **CameraPreviewFragment** are launched.

|-- MainActivity: video creation page, which can be switched to the editing screen (**ClipFragment**) and template home screen (**TemplateHomeFragment**).
|-- MediaPickActivity: material selection screen. When there is a need to select materials from the album, this screen will be launched.
|-- VideoClipsActivity: video editing screen, which can be entered via material import for creation or a draft. The upper part of the screen is the preview area, the middle part contains playback operations and the timeline, and the lower part is the two-level menu area.
|-- MaterialEditFragment: preview area, where a material can be edited. It is the entry to the zooming in or out using two fingers, dragging, rotating, and other operations on the material selected on the preview area.
|-- MenuClickManager: manager for menu clicks. The menu click event on the video editing screen is processed in the **handlerClickEvent** method. Each click event launches a corresponding fragment. All fragments inherit the **BaseFragment** abstract class, implementing the following methods: **initView**, **initObject**, **initData**, and **initEvent**. **initView** initializes the layout and component. The listener for the component is created in the **initEvent** method, to respond to the click event in each fragment and conduct relevant service logic processing.

|-- Editing-related functions:
    |-- AssetCropFragment: cropping
    |-- AssetSplitFragment: splitting
    |-- GeneralSpeedFragment: video playback speed adjustment
    |-- AnimationPanelFragment: animation
    |-- StickerPanelFragment: sticker
    |-- EditPanelFragment: text
    |-- EditTextStyleFragment: text style
    |-- EditTextAnimateFragment: text animation
    |-- EditTextBubblesFragment: text bubble
    |-- EditTextFlowerFragment: artistic font
    |-- FilterPanelFragment: filter
    |-- EffectPanelFragment: special effect
    |-- FilterAdjustPanelView: adjustment
    |-- MaskEffectFragment: mask
    |-- FaceBlockingFragment: face mask
    |-- PersonTrackingFragment: track person
    |-- TransparencyPanelFragment: transparency
    |-- VideoProportionFragment: canvas ratio
    |-- CanvasBackgroundFragment: canvas background
    |-- AudioPickActivity and MusicLocalFragment: adding music
    |-- SoundEffectFragment: adding a sound effect
    |-- AudioSpeedFragment: audio playback speed adjustment
    |-- VolumePanelFragment: volume
    |-- KeyFrameFragment: key frame
    |-- CropNewActivity: cropping
|-- Template-related functions:
    |-- TemplateHomeFragment: template home screen, which shows all template lists
    |-- TemplateDetailActivity: template details screen, which shows the effect of a template after it is selected
    |-- VideoModulePickFragment: template selection screen, which is launched after a template is selected and the button for using it is tapped
    |-- VideoModuleEditFragment: template editing screen
    |-- VideoModuleReplaceFragment: template replacement screen
|-- Export-related functions:
    |--VideoExportActivity: main screen for export
    |--ExportFragment: parameter configuration before export, export progress, and export failure
    |--ExportSuccessFragment: export success