Updated on 2022-02-22 GMT+08:00

Video Collector

This API is used to construct a video collector to open the HiLens Kit camera, construct an IP camera video collector (for the IP cameras that use the RTSP protocol), or construct a UV camera video collector (for the cameras that comply with the USB video class specifications). Currently, the HiLens Kit has two USB ports, but only one USB camera can be connected.

After the firmware is upgraded to 1.0.7 or later, this API can be used to read local MP4 files and set the width and height of the video frames read from the IP camera or local MP4 files.

  • API calling

    hilens.VideoCapture(camera)

    1.0.7 and later firmware versions:

    hilens.VideoCapture(camera, width, height)

  • Parameter description
    Table 1 Parameters

    Parameter

    Mandatory

    Type

    Description

    camera

    No

    • Character string
    • Integer 0
    • If no parameter is entered, a video collector is constructed to open the HiLens Kit camera. Only one skill of a device can use the camera. Otherwise, resource preemption will occur, causing an error.
    • If the camera name in the device configuration file is entered, an IP camera video collector is constructed. The camera name in the device configuration file is preferentially used. You can also enter a stream obtaining address in the format of rtsp://xxx.

      To view the camera name, log in to the Huawei HiLens console and choose Device Management > HiLens Kit > Camera Configuration > Camera Management.

    • If the integer 0 is entered, a UV camera video collector is constructed (the UV camera needs to be inserted).
    • If the path of the local MP4 video file is entered, an MP4 video collector is constructed.

    width

    No. This parameter must be used together with height.

    Integer

    Set the width of the read video frame image. The value must be a multiple of 16. The recommended value is a multiple of 32. The minimum value is 128. This parameter can be set only for IP cameras and MP4 video files.

    If you do not set this parameter, the original width and height of the video frame are used by default.

    height

    No. This parameter must be used together with width.

    Integer

    Set the height of the read video frame image. The value must be a multiple of 2. The minimum value is 128. This parameter can be set only for IP cameras and MP4 video files.

    If you do not set this parameter, the original width and height of the video frame are used by default.

  • Return value
    • Video collector with a camera.
    • IP camera video collector
    • UV camera video collector
    • MP4 video collector
    • If the construction fails, "CreateError" is reported. You can view skill logs.