GStreamer H.264 encoding with amlvenc

Which system do you use? Android, Ubuntu, OOWOW or others?

Ubuntu

Which version of system do you use? Khadas official images, self built images, or others?

Khadas - Fenix 1.2 Ubuntu 22.04.1 LTS Linux 5.4.180 - 20221018

Please describe your issue below:

Hardware encoder amlvenc is available for GStreamer but it offers limited functionality.
There are no options to:

  1. Switch between encoding modes e.g. CBR/VBR
  2. Configure QP settings

What is the schedule for adding these features?

Hello @vem_rw

We will check and get back to you.

Hello @vem_rw

For what application scenario must need these?

These are standard features used for encoding video, as seen with encoders available in other processors we use.

There should be an option to switch between constant bit rate (CBR) and variable bit rate (VBR).
With VBR, the quality is allowed to vary by adjusting the quantization parameter (QP)
The minimum QP setting specifies a minimum quality since higher QP degrades quality.

Any progress on adding these features?

Hello @vem_rw

Sorry, no plans to add this feature at this moment.

It is not possible to adjust the desired quality / bitrate. If this were available, we might be able to utilise the encoder. As it stands, the encoder is pretty much non-configurable.

What method does the encoder use for rate control:

  • Constant QP
  • Variable Bit Rate
  • Constant Bit Rate?

The reason for asking is because the encoder does not appear to:

  1. Prevent the bit rate overshooting the desired bitrate (by over 50%)
  2. Drop the bit rate sufficiently if the source is static

I tested 2 above by using the same camera pointing at a plain wall for a static image. I used a GStreamer pipeline with amlvenc and compared this with an equivalent pipeline using x264 for encoding. Both were configured to encode to a resolution of 1280x720 and set to a bitrate of 1200kbps.

  • amlvenc produced a stream at around 800 to 1000 kbps, whereas
  • x264 produced a stream at 80 to 100 kbps.

On other hardware that we use, Intel vaapih264enc, Rockchip mpph264enc, or anything using v4l2h264enc, the settings can be adjusted to align closely with the output of x264.

We are hoping to migrate to this board, but the uncontrollable encoder is problematic

Hello, i past one year after, but amlvenc is able to tune the bitrate.

! amlvenc bitrate = 30 !

but still you can’t selct from CBR or VBR

Regards