I’m implementing 10bit H265 encoding using OpenMAX API (since V4L doesn’t yet support 10bit YUV format) on L4T 32.1 and having trouble using HW buffers as input. I have successfully encoded ordinary CPU buffers, but with NvBuffer input it seems impossible. I have tried 2 options after setting NVX_PARAM_USENVBUFFER parameter:
- requesting buffers from encoder using OMX_AllocateBuffer
- allocating buffers myself using NvBufferCreateEx and OMX_UseBuffer
With first option I’m unable to fill the buffers with data - I need to create an EGL image from returned NvBuffer (in order to use it from CUDA), which requires fd, but ExtractFdFromNvBuffer function returns zero. With second option I get the following error when trying to encode the first frame:
NvMMLiteVideoEncDoWork: Surface resolution (0 x 0) smaller than encode resolution (2064 x 1544) VENC: NvMMLiteVideoEncDoWork: 4207: BlockSide error 0x4 Event_BlockError from 0BlockHevcEnc : Error code - 4 Sending error event from 0BlockHevcEnc
Is there a way to resolve either of these problems?
Also somewhat related question - why OpenMAX encoder requires at least 6 allocated input and output buffers, when V4L works fine with 4? In result OpenMAX requires more memory, which creates some problems.