i.MX8M Mini Hantro H1 H.264 encoder: how to set 'sample_aspect_ratio'

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

i.MX8M Mini Hantro H1 H.264 encoder: how to set 'sample_aspect_ratio'

909 Views
vincentz63
Contributor IV

I need to set the Pixel Aspect Ratio in the h.264 stream generated by the Hantro H1 encoder on the i.MX8M Mini.  In h.264 terms this is the 'sample_aspect_ratio' attribute.

Looking at the imx-vpu-hantro library (libhantro.so & libcodec.so) I can see that the library is aware of the aspect ration, but leaves it set to 0 (i.e. not specified). Hence the generated bitstream does not contain the 'sample_aspect_ratio'.

In order to be able to control it, I would need to add paramters to the structures used on the API pf the Hantro H1 and the VPU Wrapper libraries. Modifying those APIs seems somewhat wrong and I am wondering if I am missing something here?

Another option is to hardcode the pixel aspect ratio in the H1 library, but this feels even worse.

What am I missing here? Is there another way to specify the pixel aspect ratio?

Anyone else here dealing with analog cameras and non-square pixels?

Labels (1)
0 Kudos
Reply
3 Replies

881 Views
vincentz63
Contributor IV

Could you please elaborate a bit as if you are right, then I think I missing something?

As far as I can see the vpuenc_h264 element only has the following properties: gop, bitrate, quant and stream_slice_count and force_idr in the latest version.

There is no pixel-aspect-ratio property on it.

As far as I can see, the underlying libraries imx-vpu-hantro and imx-vpuwrap do not seem to expose this parameter on their API, so I am not sure how such GStreamer attribute could propagate its way down to the H1 library, but maybe I am missing something.

Other GStreamer elements do have a pixel-aspect-ratio property, like rawvideoparse, but it has nothing to do with NXP nor the VPU. I would be reluctant to use rawvideoparse as I would be concerned for the cost of the additional processing it may require.

**EDIT**

The GStreamer element vpuenc_h264 relies on the OMX IL API which as far as I can see currently does not provide a way to set the pixel aspect ratio. In fact, the API is rather limited in what it exposes. Although this feels wrong, I think I will have to modify the imx-vpu-hantro library... which leads me to my next question: why is this library provided as a .bin archive instead of being pulled from a git repo?

0 Kudos
Reply

860 Views
joanxie
NXP TechSupport
NXP TechSupport

https://bitbucket.sw.nxp.com/projects/MMCSH/repos/vpu_wrapper/browse/vpu_wrapper_hantro_VCencoder.c

https://bitbucket.sw.nxp.com/projects/MMCSH/repos/imx-vpu-hantro-daemon/browse/v4l2_vsi_daemon/src/v...

0 Kudos
Reply

888 Views
joanxie
NXP TechSupport
NXP TechSupport

maybe you can try the pixel-aspect-ratio in the gstreamer to test it

0 Kudos
Reply