tencent cloud

Feedback

Low-End Device Performance Optimization Practice Guide

Last updated: 2024-12-13 19:18:00
    Beauty effects involve AI detection, Image Process, 2D and 3D graphics rendering, animation effects, etc., which consume certain CPU and GPU resources. If the system load is already high during live streaming or shooting, adding beauty effects may cause lag or frame drops on devices with poor performance. Therefore, we have compiled a Low-End Device Performance Optimization Practice Guide to minimize the performance overhead of the beauty effects SDK on low-end devices, ensuring a good user experience.

    Definition of Low-End Devices

    The SDK provides the getDeviceLevel API to obtain the device level (API description: Android, iOS). The level ranges from 1 to 5, with 1 being the lowest-end device and 5 being the highest-end device. We recommend considering devices with a level of 3 or below as low-end devices.
    You can also determine the current device level based on your product data and the performance consumption of your app.
    By determining different device levels, reduce performance consumption on low-end devices with the following measures:

    Measure One: Using the SDK's Normal Mode

    Starting from SDK V3.9.0, when creating an SDK, you must specify EffectMode, which has two values: EffectMode_Normal and EffectMode_Pro.
    EffectMode_Normal is equivalent to the "High Performance Mode" of the older SDK version.
    EffectMode_Pro is equivalent to the default mode of the old SDK version.
    It is recommended to use EffectMode_Normal on low-end devices. For more details, see: EffectMode (High Performance Mode) Usage Guide.

    Measure Two: Disabling Certain Advanced Features of the SDK

    Disable certain advanced features through the setFeatureEnableDisable API:
    FeatureName.WHITEN_ONLY_SKIN_AREA
    Whitening only affects the skin. It is disabled by default. Enabling this feature will trigger the "skin segmentation capability." It is not recommended to enable it on low-end devices.
    FeatureName.SEGMENTATION_SKIN
    Skin segmentation capability, when enabled, makes the skin smoothing and whitening areas more precise, reducing the impact on the surrounding environment. The SDK enables it by default when the device level is 4 or higher. It is not recommended to enable it on low-end devices.
    FeatureName.SEGMENTATION_FACE_BLOCK
    Face occlusion detection capability, when enabled, prevents makeup from being applied to occlusions. The SDK enables it by default when the device level is 5 or higher. It is not recommended to enable it on low-end devices.
    FeatureName.SMART_BEAUTY
    Intelligent beauty (reduces beauty and makeup effects for men and babies). It is disabled by default. It is not recommended to enable it on low-end devices.
    Additionally, the "tanning" capability will also trigger the FeatureName.SEGMENTATION_SKIN capability. It is not recommended to use the tanning capability on low-end devices.

    Measure Three: Using Light Makeup Instead of Full Makeup

    Light makeup is a new feature introduced in version 3.9.0 of the Tencent Effect SDK. Compared to the previous "full makeup effect," light makeup performs better and can be well integrated with other effects.
    For more details, see: Light Makeup Usage Instructions.

    Measure Four: Using Higher Performance Effect Materials

    We offer a variety of effects for customers to choose from. Some effects are relatively simple and can run smoothly on low-end devices. However, some effects consume more CPU and GPU resources and are not recommended for use on low-end devices, such as 3D effects, GAN effects (e.g., baby face transformation, comic face transformation), background segmentation effects, etc.
    We provide a low-end device section for customers to choose from. For details, see the Beauty Effects Demo.

    Other Optimization Measures

    In addition to the above beauty effects optimization measures, you can also pay attention to external factors affecting performance/smoothness:

    Choosing the Appropriate Resolution

    The higher the resolution, the more pixels the SDK needs to process. For live streaming or shooting on low-end devices, it is recommended not to exceed 540P resolution.

    Setting an Appropriate Log Switch

    The SDK provides the setXmagicLogLevel API (Android, iOS) to set the log level. The default level is WARN or INFO. You can further elevate it to the ERROR level to reduce log output. Be sure not to set it to the DEBUG level, as excessive logs will affect performance.

    Checking the Pushed Stream Frame Rate

    Check if the setting is relatively low, and it is recommended to adjust it to above 24fps. If your application is not smooth even without beauty effects, you need to check the camera frame rate of the capture module. You can appropriately increase the camera frame rate to achieve smooth video. If you are using TRTC, you can refer to this documentation to adjust the frame rate.

    Checking the Performance of Modules Other Than Beauty Effects

    If your application is already lagging or the CPU usage is high before using beauty effects, it indicates that the app's performance is already problematic. Using beauty effects in this situation will only make it worse. Therefore, it is recommended to first optimize the performance of modules other than beauty effects.
    Contact Us

    Contact our sales team or business advisors to help your business.

    Technical Support

    Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

    7x24 Phone Support