当前位置:网站首页>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-27 07:53:00 【nginx】
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 the 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 .
· 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().setAccessToken("your access token");
2.2 Set a unique identity ID, namely License ID.
MediaApplication.getInstance().setApiKey("your ApiKey");
License ID It is a valid voucher for control , You need to ensure that the settings License ID Uniqueness .
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 .
MediaApplication.getInstance().setLicenseId("License ID");
(1) establish Editor object
(2) Specifies the layout location of the preview window
HuaweiVideoEditor editor = HuaweiVideoEditor.create(getApplicationContext());
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 .
(3) Initialize the running environment , If License Authentication failure , Will throw out LicenseException.
<LinearLayoutandroid: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 windowLinearLayout mSdkPreviewContainer = view.findViewById(R.id.video_content_layout);// Set the layout hosted by the preview windoweditor.setDisplay(mSdkPreviewContainer);
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 .
3“ One click action ” Capability integration
try {editor.initEnvironment();} catch (LicenseException error) {SmartLog.e(TAG, "initEnvironment failed: " + error.getErrorMsg());finish();return;}
HMS Core In addition to supporting one click action, video editing services , 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 .
// Initialize one click action AI engineimageAsset.initTimeLapseEngine(new HVEAIInitialCallback() {@Overridepublic void onProgress(int progress) {// Initialization progress}@Overridepublic void onSuccess() {// Successful initialization}@Overridepublic void onError(int errorCode, String errorMessage) {// initialization failed}});// After successful initialization , Check whether there is sky or water in the pictureint motionType = -1;imageAsset.detectTimeLapse(new HVETimeLapseDetectCallback() {@Overridepublic void onResult(int state) {// Record state As a way to add one click action AI Parameters of special effectsmotionType = state;}});// skySpeed: The speed of the sky ; skyAngle: The direction of the sky ; waterSpeed: The speed of the water ; waterAngle: The direction of water movementHVETimeLapseEffectOptions options =new HVETimeLapseEffectOptions.Builder().setMotionType(motionType).setSkySpeed(skySpeed).setSkyAngle(skyAngle).setWaterAngle(waterAngle).setWaterSpeed(waterSpeed).build();// Add one click action AI Special effectsimageAsset.addTimeLapseEffect(options, new HVEAIProcessCallback() {@Overridepublic void onProgress(int progress) {}@Overridepublic void onSuccess() {}@Overridepublic void onError(int errorCode, String errorMessage) {}});// Interrupt the one button action AI Special effects processingimageAsset.interruptTimeLapse();// Remove the one touch effect AI Special effectsimageAsset.removeTimeLapseEffect();
Learn more >>
Visit the official website of Huawei developer alliance
Get 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 ~
边栏推荐
- 「翻译」SAP变式物料的采购如何玩转?看看这篇你就明白了
- 【QT】capture. Obj:-1: error: lnk2019: unresolved external symbols__ imp_ Htons (solution)
- An open source OA office automation system
- 什么是真正的 HTAP ?(二)挑战篇
- 防止Cookie修改id欺骗登录
- DEMO SUBMIT 某程序并获取该程序ALV数据
- API 版本控制【 Eolink 翻译】
- Combined use of C WinForm form form event and delegate
- 【StoneDB Class】入门第一课:数据库知识科普
- LeetCode56. 合并区间
猜你喜欢

C# 事件用法案例 订阅事件+=

Do me a favor ~ don't pay attention, don't log in, a questionnaire in less than a minute

What about idea Chinese garbled code

IDEA中文乱码怎么办
为啥国内大厂都把云计算当成香饽饽,这个万亿市场你真的了解吗

电子量产项目框架--基本思想
![[ten thousand words long article] thoroughly understand load balancing, and have a technical interview with Alibaba Daniel](/img/fc/1ee8b77d675e34da2eb8574592c489.png)
[ten thousand words long article] thoroughly understand load balancing, and have a technical interview with Alibaba Daniel

鲁迅:我不记得说没说过,要不你自己查!
![[stonedb class] introductory lesson 1: popular science of database knowledge](/img/ec/4e3c0b91ac2ee164595c2891b23dfb.jpg)
[stonedb class] introductory lesson 1: popular science of database knowledge

Installation and use of apifox
随机推荐
Day111. Shangyitong: integrate nuxt framework, front page data, hospital details page
JS存取cookie示例
Leetcode54. 螺旋矩阵
Confluence vulnerability learning - cve-2021-26084/85, cve-2022-26134 vulnerability recurrence
The integrated real-time HTAP database stonedb, how to replace MySQL and achieve nearly 100 times the improvement of analysis performance
C commissioned use cases
Bash: sudo: command not found in container
物联网工业级UART串口转WiFi转有线网口转以太网网关WiFi模块选型
【万字长文】吃透负载均衡,和阿里大牛的技术面谈
glGetUniformLocation,glUniform4f
What is the real HTAP? (2) Challenge article
Redison 3.17.5 release, officially recommended redis client
kalibr标定realsenseD435i --多相机标定
小程序消息推送配置 Token校验失败,请检查确认
如何在 60 秒内去分析和定位问题?
mqtt指令收发请求订阅
[ten thousand words long article] thoroughly understand load balancing, and have a technical interview with Alibaba Daniel
C language: random number + Hill sort
C language: optimized Hill sort
鲁迅:我不记得说没说过,要不你自己查!