Some input video resolutions leads hardware encoding to fail.

Using nvv4l2h264enc, with resolution 1256x612, encoding ends up with the following error:

ERROR src: nvv4l2h264enc0, msg: Failed to allocate required memory.

However, with resolution 1256x613, for instance, the pipeline works as expected.
…It also works with 612x1256.

Here are some resolutions, I have tested:

  • 1256x608 OK
  • 1256x609 FAIL
  • 1256x610 FAIL
  • 1256x611 FAIL
  • 1256x612 FAIL
  • 1256x613 OK
  • 1256x614 OK
  • 1256x622 OK
  • 1256x623 OK

Using GST_DEBUG=“v4l2*:7”, the following error log shows up:

0:00:00.214981135 28693   0x55a4dec320 ERROR          v4l2allocator gstv4l2allocator.c:352:gst_v4l2_memory_group_new: buffer size 786432 is smaller then negotiated size 788736, this is usually the result of a bug in the v4l2 driver or libv4l.
0:00:00.215031409 28693   0x55a4dec320 ERROR         v4l2bufferpool gstv4l2bufferpool.c:1156:gst_v4l2_buffer_pool_start:<nvv4l2h264enc0:pool:sink> we received 0 buffer from device '/dev/nvhost-msenc', we want at least 2

The error shows up this way using omxh264enc encoder:

ERROR src: omxh264enc-omxh264enc0, msg: Internal data stream error., dbg: /dvs/git/dirty/git-master_linux/3rdparty/gst/gst-omx/omx/gstomxvideoenc.c(1383): gst_omx_video_enc_loop (): /GstPipeline:pipeline0/GstOMXH264Enc-omxh264enc:omxh264enc-omxh264enc0:stream stopped, reason not-negotiated

Using software encoding works as expected using any of those resolutions.
Are there any restrictions on the hardward encoding input resolution?

Thanks for your help

We suggest you run standard resolution like 1280x720, 1920x1080, 3840x2160. It is standard and has better compatibility across platforms.

Are you saying that you do not support encoding video at any other than those 3 resolutions? Is this documented?

Please check the capability:

We have verified standard resolutions in each release. Arbitrary resolutions may hit limitation of hardware encoder, hence not suggested. If you need special resolution in your usecase but hit error, please raise it up and we can check if it can be rounded to a working resolution by videoconvert plugin.

Hi Dane, the document you refer to does not mention the restriction you refer to.


Hi gikniz,
There is hardware limitation and I am not able to give more information. If your usecase requires non-standard resolutions, please specify it. You have mentioned 1256x609, 1256x610, 1256x611, 1256x612. These hit the limitation and we suggest you choose other close resolutions.

That is fine and understood. I was just responding to your suggestion that the link you provided refers to the restriction, which it does not. It would just be nice if Nvidia documented which resolutions were supported.

Thanks again.