Posts: 23
Joined: Mon Jan 08, 2018 6:01 am

Problem on setting avc parameters

Fri Jan 12, 2018 12:42 am

I have problem to set h264(avc) encoding parameters. SetParameter failed with error code 0x80001005 (OMX_ErrorBadParameter). The following is part of the code:

memset(&avcConfig, 0, sizeof(OMX_VIDEO_PARAM_AVCTYPE));
avcConfig.nSize = sizeof(OMX_VIDEO_PARAM_AVCTYPE);
avcConfig.nVersion.nVersion = OMX_VERSION;
avcConfig.nPortIndex = OMX_VIDENC_OUTPUT_PORT;

OMX_GetParameter(ILC_GET_HANDLE(handle->video_encode), OMX_IndexParamVideoAvc, &avcConfig);

avcConfig.nPFrames = 1;
avcConfig.nBFrames = 4;
avcConfig.eProfile = OMX_VIDEO_AVCProfileMain;
avcConfig.eLevel = OMX_VIDEO_AVCLevel3;
avcConfig.bEntropyCodingCABAC = OMX_FALSE;
avcConfig.nAllowedPictureTypes = 3;
avcConfig.nRefFrames = 1;

I am not sure what is wrong with the above settings. From OMX_video.h, "nPFrames" means number of P frames between I frames, and "nBFrames" means number of B frames between I frames. So the above setting should generate the following GOP structure?

I B B P B B I...

Could someone help me on this? Thanks!

Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 6045
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: Problem on setting avc parameters

Fri Jan 12, 2018 7:40 am

B frames aren't supported by the hardware. nBFrames must be set to 0.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

Return to “Graphics, sound and multimedia”