Rate This Document
Findability
Accuracy
Completeness
Readability

Starting a Video Stream Cloud Phone

You can configure parameters in the cfct_config file to start video stream cloud phone instances with different frame rates. You can also modify the default.prop file to start video stream cloud phone instances with different network connection modes, image capture parameters, and initial encoding parameters, or to start video stream cloud phone instances that use WebRTC for data transmission.

  1. (Optional) To start video stream cloud phone instances with different frame rates, modify the frame rate property in the cfct_config file. The default frame rate is 30 fps.
    BUILD_FPS=30
  2. (Optional) To start video stream cloud phone instances with different network connection modes, capture parameters, and initial encoding parameters, perform the following operations:
    1. Decompress DemoVideoEngine.tar.gz to obtain the vendor folder and copy the default.prop file in the folder to the current directory.
      1
      2
      3
      cd /home/kbox_video/
      tar -xvf DemoVideoEngine.tar.gz vendor
      cp vendor/default.prop .
      
    2. Set capture and encoding parameters. Modify the corresponding properties in the default.prop file, or run the setprop command in the container after the startup to modify the corresponding properties. Table 1 describes the properties.
      Table 1 Property fields of the video stream engine

      Field

      Description

      Value Range

      Default Value

      vmi.video.encodertype

      Encoder type. When this item is set to CPU, that is, when software encoding is used, if the cloud phones need to run heavy-load applications, you are advised to change the core binding mode to NUMA to prevent insufficient CPU resources in the default core binding mode (two containers, two cores). The modification method is as follows:

      Change the value of CPU_BIND_MODE in the cfct_config file to 1.

      • 0: CPU (software encoding via CPU)
      • 1: VPU (hardware encoding via external hardware)
      • 2: GPU (not supported)

      1

      vmi.video.videoframetype

      Frame data output format.

      • 0: H.264
      • 1: YUV (available only if encodertype is set to 0)
      • 2: RGB (not supported)
      • 3: H.265 (unavailable if vmi.video.encodertype is set to 0)

      0

      vmi.video.frame.width

      Width of the adaptive resolution. The value must be a multiple of 8.

      360 to 1440

      720

      vmi.video.frame.height

      Height of the adaptive resolution. The value must be a multiple of 8.

      360 to 3200

      1280

      vmi.video.frame.density

      Pixel density of the adaptive resolution.

      240 to 640

      320

      vmi.video.encode.gopsize

      Encoding GOP size.

      30 to 3000

      30

      vmi.video.encode.profile

      Encoding profile. (Only main can be used for H.265 encoding.)

      • 0: baseline (supported only in H.264 encoding)
      • 1: main
      • 2: high (supported only in H.264 encoding)

      0

      vmi.video.encode.bitrate

      Encoding bit rate.

      500000 to 50000000

      Unit: bit/s

      3000000

      vmi.video.encode.forcekeyframe

      Forced I-frame encoding.

      • 0: Disable forced I-frame encoding.
      • 1: Forcibly generate an I-frame as the next frame.

      0

      vmi.video.encode.rcmode

      Encoding format.

      • 0: average bit rate (ABR) mode (not supported)
      • 1: constant rate factor (CRF) (not supported)
      • 2: constant bit rate (CBR) mode
      • 3: capped CRF

      2

      vmi.video.encode.crf

      CRF bit rate control level.

      0 to 51

      34

      vmi.video.encode.maxcrfrate

      Maximum CRF bit rate.

      500000 to 100000000

      10000000

      vmi.video.encode.vbvbuffersize

      Size of the CRF bit rate buffer.

      • -1: auto mode
      • 0: Disable the maximum bit rate restriction.
      • min_vbv_size to 3000: When the frame rate is 30 fps, min_vbv_size is 34.

        When the frame rate is 60 fps, min_vbv_size is 17.

      1000

      vmi.video.encode.interpolation

      Frame interpolation.

      • 0: Disable frame interpolation.
      • 1: Enable frame interpolation.

      1

      vmi.audio.audiotype

      Audio output format.

      • 0: OPUS
      • 1: PCM

      0

      vmi.audio.encode.sampleinterval

      Audio output sampling interval.

      • 5: 5 ms (not supported)
      • 10: 10 ms
      • 20: 20 ms (not supported)

      10

      vmi.audio.encode.bitrate

      Audio OPUS encoding bit rate (bit/s).

      13200 to 512000

      192000

      vmi.mic.audiotype

      Microphone input format.

      • 0: OPUS
      • 1: PCM

      0

    3. To change the width and height of the adaptive resolution, you are advised to change the screen pixel density as well to achieve the optimal display effect. Table 2 lists the recommended configurations.
      Table 2 Recommended configurations for different resolutions

      Screen Width

      Screen Density (BUILD_DENSITY)

      720

      320

      1080

      480

      After you change the video output resolution (to a resolution different from the configuration at the last startup), the rendering resolution of the AOSP system and apps is changed. In this case, a compatibility issue or rendering problem may occur in some apps. Generally, this problem can be solved by restarting the app. It is recommended that you return to the home screen and clear background apps before changing the resolution.

    4. To start a video stream cloud phone instance that uses WebRTC for data transmission, change the property values in default.prop to configure the video and audio output formats. Table 3 lists the properties to be configured.
      Table 3 Property fields to be configured for using the WebRTC feature

      Field

      Description

      Value Range

      vmi.video.encodertype

      Encoder type.

      • 0: CPU (software encoding via CPU)
      • 1: VPU (hardware encoding via external hardware)
      • 2: GPU (not supported)

      vmi.video.videoframetype

      Frame data output format.

      • 0: H.264
      • 1: YUV (available only if encodertype is set to 0)

      vmi.audio.audiotype

      Audio output format.

      1 (WebRTC supports only the PCM format.)

      vmi.webrtc.connection.serverip

      IP address of the cloud phone server.

      Specific IP address

      vmi.webrtc.connection.udpbeginport

      UDP start port of the cloud phone server. By default, two UDP ports are used. After the start port is determined, the UDP ports used by the cloud phone are start port + ${index} x 2 - 1 and start port + ${index} x 2.

      Available start port

  3. Start a video stream cloud phone.
    1
    2
    cd /home/kbox_video/
    ./cfct_video start ${index1} ${index2}
    

    In the preceding command, ${index1} and ${index2} indicate instance IDs, and ${index2} can be left blank.

    Example: ./cfct_video start 2 (Start instance 2.)

    ./cfct_video start 2 5 (Start instances 2 to 5)

  4. Query video stream cloud phones.
    1
    docker ps -a
    

    The following is a command output example:

    Make sure that the started container can be found and is in normal state.

  5. Check whether the video stream cloud phone is successfully started. ${index} indicates the ID of the instance to be started. For example, in the last column in the command output of 4, the ${index} of android_35 is 35.
    1
    2
    docker exec -it android_${index} sh 
    getprop sys.boot_completed
    

    If the value of sys.boot_completed in the output is 1, the startup is successful.