Help Center/ Huawei HiLens/ Developer Guide/ Output Module/ Constructing an Output Display
Updated on 2022-02-22 GMT+08:00

Constructing an Output Display

This API is used to construct a display and output videos (image frames) to the Display class.

  • API calling

    hilens.Display(type, path=None)

  • Parameter description
    Table 1 Parameters

    Parameter

    Mandatory

    Type

    Description

    type

    Yes

    Enumeration type. Options: hilens.HDMI, hilens.RTMP, and hilens.H264_FILE.

    • hilens.HDMI: Data is output to the display through the HDMI interface of the device. Currently, only one channel of data can be displayed on the HDMI.
    • hilens.RTMP: Data is output to the RTMP server in real time for users to view.
    • hilens.H264_FILE: Data is output to a file (H.264-encoded raw video streams) for users to view.

    path

    No

    Character string

    If the file type is HDMI, ignore this parameter. If the file type is RTMP, set the path to the URL of the RTMP server (rtmp://xxxx). If the file type is H264_FILE, set the path to the output file path (for example, hilens.get_workspace_path()+"/out.h264").

    If the file type is H264_FILE, the generated file is only H.264-encoded raw video streams and does not contain information such as the frame rate. In addition, the HiLens Framework does not limit the file size. Therefore, you are advised to use this function only for debugging. If you need to save large files, you are advised to set the file location to /var/lib/docker.

  • Return value

    A display instance is returned.

    If the construction fails, "CreateError" is reported. You can view skill logs or run the cat /dev/logmpp command to locate the fault.