当前位置:网站首页>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 ~
边栏推荐
猜你喜欢

Implementation of MATLAB short-time autocorrelation

Schematic diagram of MOS tube

梦里的一碗面

matlab 短时自相关实现

2018 arXiv preprint | MolGAN: An implicit generative model for small molecular graphs

正规方程法(Normal Equation)原理以及与梯度下降法的区别

JDBC summary

新兴市场潜力无限,ADVANCE.AI风控产品助中国出海企业筑牢安全发展基础

OPPO 自研大规模知识图谱及其在数智工程中的应用

Unity对资源管理器操作 打开资源管理器选择文件并筛选文件
随机推荐
【C语言基础】17 链表初探
45、实例分割的labelme数据集转coco数据集以及coco数据集转labelme数据集
unity 获取网络时间
TASK04|分类分析
Matlab pitch period estimation post-processing
npm, npm中文文档, npm学习使用
Ansible installation and use
SQL注入 Less24(二次注入)
jmeter -- response中文乱码处理
Jd.com won the highest award for intelligent science and technology in China! Inventory JD system intelligent technology
同花顺手机炒股开户安全吗?怎么办理开户呢
Isilon 的OneFs常见操作命令(一)
Get network time by unity
mysql推荐书
Oppo self-developed large-scale knowledge map and its application in digital intelligence engineering
Go --- identifiers and keywords in go language
08 Du command
win10下mysql改密码后,突然登录不上的问题解决过程记录
Altium Designer 22 修改选中元件的层属性
Development to testing: a six-year road to automation from scratch