Details on encoder settings (Accelerated GStreamer)

Hello everybody,

I was wondering about the range of the parameters of the accelerated encoders supported in GStreamer (nvv4l2 & omx). For example, the iframeinterval parameter has a range of 0 to 4294967295.

How is this range mapped on the actual I-frame interval?
How is it with the other encoder parameters?

Thanks in advance and best regards,
Bruno

Hi,
Theoretically iframeinterval can be set to very large value, but generally we set it to 1-2 second interval so that you can seek in the stream more easily. Since decoding starts from I frames.

For 30fps, we suggest set to 30 or 60.

Hi DaneLLL,

thank you for your answer!

So, the actual I frame interval is iframeinterval/framerate?

What about the other numeric parameters?

  • quant-i/p/b-frames
  • SliceIntraRefreshInterval
  • slice-header-spacing

Is there a general mapping/scaling process of the 32bit/64bit parameters?
The quantization parameters (quant-i/p/b-frames) of the nvv4l2h264enc have a default value of 2^32 - 1. If that is the true value of the quantization parameter (no mapping/scaling) I have a wrong understanding of the quantization process.

Best regards
Bruno

Hi,

  • quant-i/p/b-frames
    qp range is 0 - 51. Please set in this range.

  • SliceIntraRefreshInterval
    iframeinterval is to set interval of IDR frames, and SliceIntraRefreshInterval is to set interval of I frames. generally we set IDR frame interval > I frame inteval. Such as iframeinterval=30 SliceIntraRefreshInterval=15

  • slice-header-spacing
    This is to set how many macroblocks are put in one encoded slice. There is same properties in jetson_multimedia_api sample and please refer to
    How does slice mode video encoding work for Jetson? - #14 by DaneLLL
    So the range depends on the resolution.

Hi DaneLLL,

thank you very much. This helped a lot!

It would be helpful to put this information in the documentation (gst-inspect-1.0 or Nvidia online documentation on Accelerated GStreamer)

Best regards
Bruno

Hi,
Thanks for the suggestion. We will try to improve the document. If you have further questions about setting properties, please feel free to make a post.

Hi DaneLLL,

I have some additional questions:

  1. Assuming I set quant-i/p/b-frames to a value higher than 51, e.g. 255, what is the resulting value? Is it capped at 51 and higher values are set to 51?
  2. The terms are a bit confusing for me, so I would be happy if you could clarify the following questions:
    The i-frames are keyframes, i.e., full frames and may come as IDR frame or non-IDR frame?
    The p-frames and b-frames are intra-frames, i.e., no full frames and are “predictions” which reference to the previous frames?
  3. Do the SliceIntraRefreshInterval and iframeinterval have a significant impact on video quality?
    Background to this question: The IDR frames are keyframes, i.e., full frames. The smaller the interval the higher the number of full frames in the encoded video, hence more detail / higher video quality. Thats how I thought it would work, but not how the encoder actually performs the compression. Where am I wrong and what did I miss respectively?

Best regards
Bruno

Hi,

If you set qp value > 51, it is capped at 51.

Intra frames are also I frames, please check difference of IDR and I frames:
The difference between the I frame and IDR frame in H264

Yes, it has impact to video quality. Since IDR/I frames have larger size, if setting the interval to small size, more bits are distributed in IDR/I frames. We would suggest set interval to ~ 1 second. For 30 fps, suggest set interval = 30.