可帮助视频编辑开发者实现视频处理功能,支持视频缩放增强、动态元数据生成及色彩空间转换,提供直观操作界面,支持选择视频、处理及播放,不支持时会提示,适配华为手机等标准系统设备。
Access rate limit exceeded. Please log in to continue.
Using VideoProcessing to Process Video
Overview
This sample is intended for video editing developers and provides guidance for them to use VideoProcessing to perform video scaling enhancement, dynamic metadata generation, and color space conversion.
Preview

How to Use
- Tap Select Video to select the video to be processed.
- Tap Video zoom. A dialog box is displayed, showing the video scaling enhancement levels. Select an enhancement level to enhance the video.
- Tap Metadata generation. In the dialog box displayed, select a metadata format to generate a video with the corresponding metadata.
- Tap Color space conversion. In the dialog box displayed, generate the video with the corresponding color space based on the color space format.
- Tap Play the video to play the video. No processing is performed.
- If a processing type is not supported for the video, the message indicating that the video does not support the current operation will be displayed when you tap the processing button.
Project Directory
├──entry/src/main/ets/
│ ├──common
│ │ ├──entryability
│ │ │ └──CommonConstants.ets // Common constants
│ │ └──utils
│ │ ├──DateTimeUtil.ets // Date utility class
│ │ ├──Logger.ets // Log utility class
│ │ └──WindowUtil.ets // Window setting utility class
│ ├──entryability
│ │ └──EntryAbility.ets // Entry ability class
│ ├──page
│ │ └──VideoPage.ets // Video processing page
│ └──view
│ └──MultiStatusButton.ets // Custom status button
├──entry/src/main/cpp/
│ ├──CMakeLists.txt // Build script
│ ├──capbilities
│ │ ├──AudioDecoder.cpp // Audio decoding implementation class
│ │ ├──Demuxer.cpp // Demuxing implementation class
│ │ ├──VideoDecoder.cpp // Video decoding implementation class
│ │ └──include
│ │ ├──AudioDecoder.h // Audio decoding header file
│ │ ├──Demuxer.h // Demuxing header file
│ │ └──VideoDecoder.h // Video decoding header file
│ ├──common
│ │ ├──SampleCallback.cpp // Callback implementation class
│ │ ├──SampleCallback.h // Callback header file
│ │ ├──SampleInfo.h // Data entity class
│ │ └──dfx
│ │ ├──error
│ │ │ └──AVCodecSampleError.h // Error code constant class
│ │ └──log
│ │ └──AVCodecSampleLog.h // Log utility class
│ ├──render
│ │ ├──PluginManager.cpp // Plug-in management implementation class
│ │ ├──PluginRender.cpp // Rendering plug-in implementation class
│ │ └──include
│ │ ├──PluginManager.h // Plug-in management header file
│ │ └──PluginRender.h // Rendering plug-in header file
│ ├──sample
│ │ └──player
│ │ ├──Player.cpp // Playback implementation class
│ │ ├──Player.h // Playback header file
│ │ ├──PlayerNative.cpp // N-API implementation class
│ │ └──PlayerNative.h // N-API header file
│ └──types
│ └──player
│ ├──index.d.ts // N-API
│ └──oh-package.json5 // Definition of player .so and .d.ts files
└──entry/src/main/resources // Static resources
Required Permissions
ohos.permission.READ_MEDIA: access media files
Constraints
- This sample is only supported on bar-type phones running standard systems.
- The HarmonyOS version must be HarmonyOS 5.0.4 Release or later.
- The DevEco Studio version must be DevEco Studio 5.0.4 Release or later.
- The HarmonyOS SDK version must be HarmonyOS 5.0.4 Release SDK or later.