Rate This Document
Findability
Accuracy
Completeness
Readability

Using HW265Enc

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

Use HW265Enc to encode test.yuv and output the result to test.265.

  • Encoding an 8-bit sequence
    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.265

    Information similar to the following is displayed:

    ShortInterface 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.265
    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!!
  • Encoding a 10-bit sequence

    Rename libhw265.so to libhw265_8bit.so and libhw265_10bit.so to libhw265.so for linking.

    mv ./lib/libhw265.so ./lib/libhw265_8bit.so
    mv ./lib/libhw265_10bit.so ./lib/libhw265.so
    The following is an example of the encoding command:
    ./bin/CloudHw265App_10bit -c ~/dependency/lib/cfg/hw265_encoder.cfg -preset 6 -w 2560 -h 1600 -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.265

    Information similar to the following is displayed:

    ShortInterface Mode: current version is LOG-iMedia Video III 5.5.1.B001, 01:00:00  May 25 2026, 10 
    Input YUV file    : test.yuv 
    Output stream file: test.265 
    Begin encoding: test.yuv res 2560x1600
    Total Frames: 301, init encode time: 90ms, del encode time: 467ms, pure time: 4468ms, FPS: 67.3657
    bitrate: 6920.3976
    Total Time: 5454ms, TotalFps: 55.1886
    Encoding CpuUsage: 	3.75%
    Encode Success!!
  • HW265Enc command line parameters
    Table 1 describes the parameters that can be configured when HW265Enc is used for encoding.
    Table 1 HW265Enc command line parameters

    Parameter

    Description

    Command Line Example

    -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. The encoding speed increases with each level, while the corresponding 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

    -frames <integer>

    Indicates the number of frames to be encoded.

    -frames 1000

    -channel <integer>

    Indicates the channel ID of the encoder.

    -channel 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

    -keyInt <integer>

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

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

    -keyInt 30

    -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 [40, 300000].

    -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

    -delay <integer>

    Sets the number of frames buffered for time-domain 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

    -sar_width <integer>

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

    -sar_width 1

    -sar_height <integer>

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

    -sar_height 1

    -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

    -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

    -hdrMode

    Sets the HDR mode.

    • 0: disabled
    • 1: HDR10

    -hdrMode 1

    -repeatHeaders

    Sets whether to repeat header information such as VPS/SPS/PPS/SEI before each IDR frame.

    • 0: Yes
    • 1: No

    -repeatHeaders 1

    -max-cll

    Sets the maximum content light level (maxContentLightLevel).

    -max-cll 1000

    -max-fall

    Sets the maximum frame average light level (maxPicAverageLightLevel).

    -max-fall 300

    -primaries-x0

    Sets the X coordinate of the red primary color (displayPrimariesX0).

    -primaries-x0 8500

    -primaries-y0

    Sets the Y coordinate of the red primary color (displayPrimariesY0).

    -primaries-y0 39850

    -primaries-x1

    Sets the X coordinate of the green primary color (displayPrimariesX1).

    -primaries-x1 6550

    -primaries-y1

    Sets the Y coordinate of the green primary color (displayPrimariesY1).

    -primaries-y1 2300

    -primaries-x2

    Sets the X coordinate of the blue primary color (displayPrimariesX2).

    -primaries-x2 35400

    -primaries-y2

    Sets the Y coordinate of the blue primary color (displayPrimariesY2).

    -primaries-y2 14600

    -white-x

    Sets the X coordinate of the white point (whitePointX).

    -white-x 15630

    -white-y

    Sets the Y coordinate of the white point (whitePointY).

    -white-y 16450

    -max-luminance

    Sets the maximum display mastering luminance (maxDisplayMasteringLuminance).

    -max-luminance 10000000

    -min-luminance

    Sets the minimum display mastering luminance (minDisplayMasteringLuminance).

    -min-luminance 1

    -atc-sei

    Sets the alternative transfer characteristics for video content (preferredTransferCharacteristics).

    -atc-sei 2