当前位置:网站首页>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 16:16:00 【HMS Core】
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 ~
边栏推荐
- Is it safe for CICC fortune to speculate in stocks? The securities company with the cheapest handling fee
- Sword finger offer special assault edition day 11
- Technology vane | interpretation of cloud native technology architecture maturity model
- ROS problems and Solutions - relying on package installation and unable to correct errors
- Pat grade a 1050 string subtraction
- Research and application of the whole configuration of large humanoid robot
- ZABBIX 6.2.0 deployment
- PAT甲级 1049 Counting Ones
- Bugku login2
- Interface test for quick start of JMeter
猜你喜欢

parker电磁阀D1VW020DNYPZ5

2022 latest Beijing Construction Safety Officer simulation question bank and answers

测试用例千万不能随便,记录由一个测试用例异常引起的思考

“核弹级” Log4j 漏洞仍普遍存在,并造成持续影响

德国EMG易安基推动器ED301/6 HS
![[RCTF2015]EasySQL](/img/68/328ee5cffc8b267b6b0f284eb8db2c.png)
[RCTF2015]EasySQL

The "nuclear bomb level" log4j vulnerability is still widespread and has a continuing impact

Implementation of personalized healthy diet recommendation system based on SSM

技术风向标 | 云原生技术架构成熟度模型解读
![[BJDCTF2020]Easy MD5](/img/6a/61a4b5624c33f1f334bea344cfa2c8.png)
[BJDCTF2020]Easy MD5
随机推荐
Jointly discuss the opening of public data, and the "digital document scheme" appeared at the digital China Construction Summit
Draw a beautiful outline of the middle school playground and generate longitude and latitude data
操作系统迁移实战之在openEuler上部署MySQL数据库
Mapwithstate of spark streaming state flow
初识OpenGL (3)片段着色器(Fragment Shader)
德国emg电动执行器EB800-60II
Collection of open source expert opinions on trusted privacy computing framework "argot"
博途PLC顺序开关机功能块(SCL)
PAT甲级 1046 Shortest Distance
Pat grade a 1048 find coins
PAT甲级1048 Find Coins
朋友圈如何测试(思维导图)
ROS problems and Solutions - relying on package installation and unable to correct errors
Summary of key knowledge of C language
JVM 的类初始化机制
C# 给Word每一页设置不同文字水印
Clojure 运行原理之编译器剖析
共议公共数据开放,“数牍方案”亮相数字中国建设峰会
Google Earth engine - merra-2 m2t1nxlv: 1980 present global pressure, temperature, wind and other data sets
Implementation of personalized healthy diet recommendation system based on SSM