我要评分
获取效率
正确性
完整性
易理解

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 capture 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. If a GPU that supports integrated rendering and streaming is used for encoding, set this item to 2.

      In the integrated rendering and streaming environment, only the GPU option is supported. The CPU and VPU options are unavailable.

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

      1

      vmi.video.videoframetype

      Frame data output format.

      • 0: H.264
      • 1: YUV (not supported)
      • 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 2.

      360 to 1440

      720

      vmi.video.frame.height

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

      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 30000000

      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 (not supported)

      2

      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.

      • 1: VPU (hardware encoding via external hardware)
      • 2: GPU (hardware encoding via GPU)

      vmi.video.videoframetype

      Frame data output format.

      • 0: H.264

      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.
    • Video stream cloud phone with Docker:
      1
      docker ps -a
      

      The following is a command output example:

    • Video stream cloud phone with containerd:
      1
      nerdctl 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.
    • Video stream cloud phone with Docker:
      1
      docker exec -it android_${index} sh 
      
    • Video stream cloud phone with containerd:
      1
      nerdctl exec -it android_${index} sh
      
    1
    getprop sys.boot_completed
    

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