This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

How to change H.264 encoder resolution dynamically?

Hi, we are using OMX H264 encoder with DM8148/EZSDK_5_05_02_00.

Our system has multiple video inputs and need to switch between them.  The resolutions of the videos are different, so we need to change the size of H.264 encoding at runtime. 

I followed the samples of changing parameters dynamically, and wrote up the code below, but it doesn't work.  When switching from 1280x720->640x480, the 640x480 image seems to be shrunk in half vertically in upper half of the image and the lower half is garbage.

How can I make it work?
Thanks,
tamo2

OMX_INIT_PARAM (&tDynParams);

tDynParams.nPortIndex = OMX_VIDENC_OUTPUT_PORT;

eError = OMX_GetConfig (pHandle, (OMX_INDEXTYPE)OMX_TI_IndexParamVideoDynamicParams, &tDynParams);
tDynParams.videoDynamicParams.h264EncDynamicParams.videnc2DynamicParams.inputHeight =  newHeight;

tDynParams.videoDynamicParams.h264EncDynamicParams.videnc2DynamicParams.inputWidth = newWidth;
tDynParams.videoDynamicParams.h264EncDynamicParams.videnc2DynamicParams.captureWidth = newStride;

eError = OMX_SetConfig(pHandle, (OMX_INDEXTYPE)OMX_TI_IndexParamVideoDynamicParams, &tDynParams);

// Do the same thing for INPUT.

  • Hello,

    The input/output port configuration cannot be changed once the component is in an executing state.

    You could try for resolution change  to take OMX client to loaded state, free up the buffers, allocate new buffers and then move to executing state again.

    Best Regards,

    Margarita