当前位置:网站首页>Want the clouds in the picture to float? Video editing services can be achieved in three steps with one click
Want the clouds in the picture to float? Video editing services can be achieved in three steps with one click
2022-07-26 22:14:00 【Huawei mobile services】
Sharing and creating short videos has become a way for people to record a better life , Many users will have insufficient material when editing , At this time, we often choose to use a few pictures as supplementary materials . But inserting pictures in the video will make the transition part of the work appear very stiff and deliberate ; So how to make up for the shortcomings of pictures through post editing , Let users smoothly complete video creation ?
Adding dynamic effects to pictures can solve this problem , Dynamic effect can make still photos produce dynamic video effects , Be able to connect fragments naturally and smoothly , Make the whole work more harmonious .

This dynamic effect , You need to manually set the anchor point in the professional special effect tool , To produce the effect of fluid movement , The operation is complicated . And now , Integrating Huawei HMS Core Video editing services “ One click action ” function , This will enable users to achieve this effect quickly , Let the static scenery photos in the mobile photo album , You can... Anytime, anywhere “ move ”.
HMS Core Video editing services “ One click action ” function
“ One click action ” Function allows static landscape pictures to achieve dynamic video effects , Enter a picture with sky or water ,“ One click action ” Let the clouds float in the sky or the water flow . Developers can also manually set the movement speed 、 Direction of motion 、 One click removal effect, etc , Make the dynamic effect more realistic .
Now let's practice how to integrate Huawei video editing services , Realization “ One click action ” function :
1 . The development of preparation
For detailed preparation steps, please refer to Official website of Huawei developer Alliance
2. Edit project integration
2.1 Set the authentication information of the application
Can pass api_key perhaps Access Token To set the application authentication information .
· adopt setAccessToken Method setting Access Token, You can initialize the settings once when the application starts , There is no need to set it more than once .
MediaApplication.getInstance().setAccessToken("your access token");· adopt setApiKey Method setting api_key, You can initialize the settings once when the application starts , There is no need to set it more than once .
MediaApplication.getInstance().setApiKey("your ApiKey");2.2 Set a unique identity ID, namely License ID.
License ID It is a valid voucher for control , You need to ensure that the settings License ID Uniqueness .
MediaApplication.getInstance().setLicenseId("License ID");initialization Editor Running environment , Create edit project , You need to create it first Editor Object and initialize its running environment . When you leave editing a project , Should be released Editor example .
(1) establish Editor object
HuaweiVideoEditor editor = HuaweiVideoEditor.create(getApplicationContext());(2) Specifies the layout location of the preview window
The preview window is responsible for the rendering of video images , Atomic power by video editing SDK Create inside SurfaceView To achieve . Before creating the window , Need to be in your App Specify the layout location of the preview window in .
<LinearLayout
android:id="@+id/video_content_layout"
android:layout_width="0dp"
android:layout_height="0dp"
android:background="@color/video_edit_main_bg_color"
android:gravity="center"
android:orientation="vertical" />
// Specify the preview window
LinearLayout mSdkPreviewContainer = view.findViewById(R.id.video_content_layout);
// Set the layout hosted by the preview window
editor.setDisplay(mSdkPreviewContainer);(3) Initialize the running environment , If License Authentication failure , Will throw out LicenseException.
When Editor After the object is created , At this time, the actual system resources have not been occupied , You need to manually select the timing of its environment initialization , At this point, the atomic power of video editing SDK Necessary threads and timers will be created internally .
try {
editor.initEnvironment();
} catch (LicenseException error) {
SmartLog.e(TAG, "initEnvironment failed: " + error.getErrorMsg());
finish();
return;
}3 “ One click action ” Capability integration
// Initialize one click action AI engine
imageAsset.initTimeLapseEngine(new HVEAIInitialCallback() {
@Override
public void onProgress(int progress) {
// Initialization progress
}
@Override
public void onSuccess() {
// Successful initialization
}
@Override
public void onError(int errorCode, String errorMessage) {
// initialization failed
}
});
// After successful initialization , Check whether there is sky or water in the picture
int motionType = -1;
imageAsset.detectTimeLapse(new HVETimeLapseDetectCallback() {
@Override
public void onResult(int state) {
// Record state As a way to add one click action AI Parameters of special effects
motionType = state;
}
});
// skySpeed: The speed of the sky ; skyAngle: The direction of the sky ; waterSpeed: The speed of the water ; waterAngle: The direction of water movement
HVETimeLapseEffectOptions options =
new HVETimeLapseEffectOptions.Builder().setMotionType(motionType)
.setSkySpeed(skySpeed)
.setSkyAngle(skyAngle)
.setWaterAngle(waterAngle)
.setWaterSpeed(waterSpeed)
.build();
// Add one click action AI Special effects
imageAsset.addTimeLapseEffect(options, new HVEAIProcessCallback() {
@Override
public void onProgress(int progress) {
}
@Override
public void onSuccess() {
}
@Override
public void onError(int errorCode, String errorMessage) {
}
});
// Interrupt the one button action AI Special effects processing
imageAsset.interruptTimeLapse();
// Remove the one touch effect AI Special effects
imageAsset.removeTimeLapseEffect();HMS Core Video editing services In addition to supporting one click action , It also provides basic video editing 、AI To color 、 Exclusive filter 、 Highlights 、 One button hair dyeing 、 Character tracking 、 Video creation ability such as face hiding , Developers can choose according to the application scenario , stay App Easily complete the integration of video editing functions .
Learn more >>
visit Official website of Huawei developer Alliance
obtain Development guidance document
Huawei mobile service open source warehouse address :GitHub、Gitee
Pay attention to our , The first time to understand HMS Core Latest technical information ~
边栏推荐
- 进程的概念和分类
- Determine the dimension of numpy array array
- xshell7个人免费下载,使用
- Pytorch torch. add() torch. add_ () usage
- Pytoch squeeze() unsqueeze() usage
- MPLS基础知识概述
- 寻找数字零售的发展新方向,才是保证数字零售可以进入到全新发展阶段的关键
- easyui datagrid 获取多条选中的数据进行操作
- jmeter -- response中文乱码处理
- Alibaba three sides: how to solve the problems of MQ message loss, duplication and backlog?
猜你喜欢
随机推荐
Afnetworking understand
imshow()函数后面如果不加waitKey()函数就不显示
NPM, NPM Chinese documents, NPM learning and using
matlab 基音周期估计后处理
C# 数据类型_摘自菜鸟教程
Altium Designer 22 中文字符乱码
Li Kou daily question - day 43 -168. Name of Excel table column
Just one dependency to give swagger a new skin, which is simple and cool~
Can you use redis? Then come and learn about redis protocol
If you do not add waitkey() function after imshow() function, it will not be displayed
自己学习Cesium的笔记简介
同花顺上面开户安全吗,开户怎么选券商
Unity installation failed: operation not allowed, MKDIR
Oppo self-developed large-scale knowledge map and its application in digital intelligence engineering
d和c的符区别
Props with type Object/Array must...
A friend with a monthly salary of 50000 told me that you were just doing chores
SQL注入 Less26(过滤空格和注释符,使用不带空格的报错注入)
matlab 画短时平均幅度谱
Isilon's onefs common operation commands (I)









