Rate This Document
Findability
Accuracy
Completeness
Readability

Using HW265Enc

The following uses the conversion from a YUV file to an MP4 file as an example to describe how to use the encoding commands of HW265Enc.

Use HW265Enc to encode test.yuv and output the encoded file to test.mp4. The following is an example of the encoding command:
./bin/CloudHw265App -c ~/dependency/lib/cfg/hw265_encoder.cfg -preset 6 -w 1920 -h 1080 -rc 0 -br 8000 -pass 0 -fps_num 30 -fps_den 1 -timebase_den 30 -timebase_num 1 -frames 9999 -keyInt 120 -adap_i 0 -bframes 3 -delay 4 -FrmThreadNum 4 -WppThreadNum 4 -LookAheadThreads 3 -i test.yuv -b test.mp4

When HW265Enc is used, the configurable parameters are shown in Table 1.

The command output is as follows:

ShortInterfacr Mode: current version is LOG-iMedia Video III 5.5.1.B001, 10:57:09  Apr 18 2025, 10
Input YUV file    : test.yuv
Output stream file: test.mp4
Begin encoding: test.yuv res 1920x1080
Total Frames: 600, init encode time: 44ms, del encode time: 70ms, pure time: 11459ms, FPS: 52.3601
bitrate: 7965.0008
Total Time: 11960ms, TotalFps: 50.1643
Encoding CpuUsage:      5.43%
Encode Success!!
Table 1 HW265Enc command line options

Parameter

Description

Command

-v

Queries version information.

-v

-h

Lists all options.

-h

-c <string>

Indicates the path to the configuration file.

-c ~/dependency/lib/cfg/hw265_encoder.cfg

-preset <integer>

Sets the encoding quality level. Available level options are 2, 3, 5, and 6. As the encoding speed increases, the encoding quality decreases. The default value is 3.

-preset 6

-i <string>

Inputs the YUV 4:2:0 file.

-i input.yuv

-b <string>

Outputs the bitstream file.

-b output.bit

-start <integer>

Indicates the first frame (0 to N) to be encoded.

-start 100

-frames <integer>

Indicates the number of frames to be encoded.

-frames 1000

-channel <integer>

Indicates the channel ID of the encoder.

-channel 1

-repeat_ps <bool>

Repeats the Sequence Parameter Set (SPS) and the Picture Parameter Set (PPS) before each I-frame.

-repeat_ps 1

-sublayer <integer>

Indicates the number of temporal sublayers (1 to 3).

-sublayer 2

-scenecut <bool>

Enables scenecut detection.

-scenecut 1

-low_delay <bool>

Indicates low-latency encoding used in applications like video conferencing.

-low_delay 1

-w <integer>

Indicates the image width (in pixels). The value range is [160, 4096].

-w 1920

-h <integer>

Indicates the image height (in pixels). The value range is [96, 4096].

-h 1080

-iStride <integer>

Indicates the stride of the luma component (in pixels).

-iStride 1920

-key <integer>

Indicates the keyframe interval. The value range is [0, 65535].

  • -1: Only the first frame is an I-frame.
  • 1: All frames are I-frames.

-key 30

-slice_mode <integer>

Indicates the slice mode.

-slice_mode 1

-slice_arg <integer>

Indicates the slice argument.

-slice_arg 100

-rc <integer>

Indicates the rate control mode.

  • 0: average bit rate (ABR)
  • 1: constant rate factor (CRF)

-rc 0

-br <integer>

Indicates the target bit rate (kbit/s). The value range is [10, 80 x 1000].

-br 5000

-crf <integer>

Sets a CRF value. The value range is [0, 51]. The default value is 23. This parameter is valid only in the CRF mode.

-crf 23

-fr <integer>

Indicates the frame rate multiplied by 1000. The value range is [5000, 300000].

-fr 30000

-pass <integer>

Specifies whether to enable multi-pass encoding.

  • 0: No
  • 1: First pass
  • 2: Second pass

-pass 0

-fps_num <integer>

Indicates the numerator of the frame rate.

-fps_num 30

-fps_den <integer>

Indicates the denominator of the frame rate (forming the frame rate with the numerator, for example, 30/1).

-fps_den 1

-timebase_num <integer>

Indicates the numerator of the time base.

-timebase_num 1

-timebase_den <integer>

Indicates the denominator of the time base (forming the time base with the numerator, for example, 1/30. The time base is the reciprocal of the frame rate).

-timebase_den 30

-adap_i <integer>

Specifies whether to enable scene-adaptive I-frames.

  • 0: No
  • 1: Yes

-adap_i 0

-bframes <integer>

Indicates the maximum consecutive B-frames. The value range is [0, 7].

-bframes 3

-delay <integer>

Sets the number of frames buffered for temporal analysis. The value range is [0, 150].

-delay 4

-FrmThreadNum <integer>

Sets the number of threads for frame-level encoding. The value range is [1, 38].

-FrmThreadNum 4

-WppThreadNum <integer>

Sets the number of threads for Wavefront Parallel Processing (WPP) row-level encoding. The value range is [1, 20].

-WppThreadNum 4

-LookAheadThreads <integer>

Sets the number of lookahead pre-analysis threads. The value range is [1, 48].

-LookAheadThreads 4

-vbv_Delay <integer>

Indicates the video buffering verifier (VBV) delay (in ms). The value range is [500, 30000].

-vbv_Delay 1000

-skip <bool>

Specifies whether to enable frame skipping.

-skip 1

-qp <integer>

Indicates the initial quantization parameter (QP) used by the encoder: -1 or [0, 51].

-qp 25

-max_qp <integer>

Indicates the maximum QP. The value range is [0, 51].

-max_qp 51

-min_qp <integer>

Indicates the minimum QP. The value range is [0, 51].

-min_qp 0

-cb_qp_offset <integer>

Indicates the Cb QP offset of the picture. The value range is [−12, 12].

-cb_qp_offset 0

-cr_qp_offset <integer>

Indicates the Cr QP offset of the picture. The value range is [−12, 12].

-cr_qp_offset 0

-lp_cross_slice <bool>

Specifies whether to enable loop filtering across slices.

  • 1: Yes
  • 0: No

-lp_cross_slice 1

-lp_cross_tile <bool>

Specifies whether to enable loop filtering across tiles.

  • 1: Yes
  • 0: No

-lp_cross_tile 1

-sao_luma <bool>

Specifies whether to enable sample adaptive offset (SAO) for the luma component.

-sao_luma 1

-sao_chroma <bool>

Specifies whether to enable SAO for the chroma component.

-sao_chroma 1

-df_disable <bool>

Specifies whether to disable deblocking filtering.

-df_disable 0

-df_beta <integer>

Indicates the Beta offset divided by 2. The value range is [–13, 13].

-df_beta 0

-df_tc <integer>

Indicates the Tc offset divided by 2. The value range is [–13, 13].

-df_tc 0

-sar_w <integer>

Indicates the sampling aspect ratio. The value range is [0, 65535].

-sar_w 1

-sar_h <integer>

Indicates the sampling aspect ratio. The value range is [0, 65535].

-sar_h 1

-sei_size <integer>

Indicates the Supplemental Enhancement Information (SEI) size (in bytes).

-sei_size 1024

-sei_data <string>

Indicates the SEI data.

-sei_data "abc123"

-qual_enh_mode <integer>

Indicates the quality enhancement mode. The value range is [0, 4].

-qual_enh_mode 2

-qual_enh_level <integer>

Indicates the quality enhancement level. The value range is [1, 8].

-qual_enh_level 4

-qual_enh_thread_num <integer>

Indicates the number of quality enhancement threads.

-qual_enh_thread_num 4