Nvv4l2h264enc latency and preset-level

Hi,
What is the relationship between the preset-level and the H264 encoding latency?
This my test results:

preset 0 preset 1 preset 2 preset 3 preset 4
Total frames 409 646 623 568 720
max latency (ms) 112 135 104 121 75
average latency (ms) 15.50 13.83 13.51 15.39 15.17
min latency (ms) 11 10 10 11 11

The test was carried out at the same test conditions except changed the preset-level.
Would you please let me know:

  1. The H264 average encode latency at 14 ms, is correct?
  2. Changing the preset level, I can’t see the encoding latency changes significantly, is it correctly?
  3. If my test output is not correct, what can I do for it?
    Thanks

CX

Hi,
The test result is dependent to resolution and frame rate. If you would like to achieve 4Kp30 encoding , you only can set to UltraFastPreset. If your use-case is single 1080p30 encoding, you may set to other preset to get better image quality.

So if you run 4K encoding and compare the preset levels, should see different result and fps.

We don’t have test data for latency. For achieving low latency, suggest you set the properties:

  poc-type            : Set Picture Order Count type value
                        flags: readable, writable, changeable only in NULL or READY state
                        Unsigned Integer. Range: 0 - 2 Default: 0
  maxperf-enable      : Enable or Disable Max Performance mode
                        flags: readable, writable, changeable only in NULL or READY state
                        Boolean. Default: false

For encoding into I P P P … frames, encoder would need to keep one reference frame so you should see one-frame delay. If your source is in 30fps, there is 33ms latency.

Thank you for your kind reply.
My video streaming frame size is 2592 x 1944 less than 4k. frame rate is 24 fps.
This is my test script for OpenCV VideoCapture

v4l2src device=/dev/video0 \
    ! video/x-raw, format=UYVY, width=2592, height=1944, framerate=24/1 \
    ! nvvidconv ! video/x-raw(memory:NVMM), format=I420 \
    ! tee name=camNVMM ! queue ! nvv4l2h264enc preset-level=1 MeasureEncoderLatency=1 maxperf-enable=true insert-vui=true insert-sps-pps=1\
    ! tee name=h264_stream ! queue ! h264parse ! rtph264pay ! udpsink clients=192.168.18.18:38298 \
    h264_stream. ! queue ! h264parse ! matroskamux ! filesink location=test_h264.mkv \
    camNVMM. ! queue ! nvvidconv ! video/x-raw, format=GRAY8, width=640,height=480 ! appsink

maxperf-enable=true.
I don’t know how to set poc-type. Would you please give me your suggestion based on my script above?
Thanks
CX