TK1 OpenMax H264 encoder

Hi,
I am using OpenMax to encode 1080p video on android, the maximum rate is only 15fps. Does anyone know it is normal?

You’ll probably need to provide more information…which exact android, on what hardware? The rate sounds rather low for anything with GPU acceleration.

Thanks,linuxdev.
It seems not accelerate with GPU, it has hardware encode unit.
I test on android 4.4, Tegra K1. The spec. of TK1 says 1080p60(I guess it is 60 fps in 1080p), I use JNI with OpenMax(OMX.Nvidia.h264.encoder) to test directly, the result is also about 15fps, so I don’t know where is the problem?

Unless your android had apps specifically coded for using the hardware, it won’t be using it. Defaults from outside of the installs not intended specifically for Jetson simply won’t know about the hardware nor have any way to use it.

The android version in the sticky topic here is likely the best bet on TK1…is this what you installed?
https://devtalk.nvidia.com/default/topic/878820/embedded-systems/android-l-update-to-jetson-tk1/

Hi, I run my test on ubuntu 14.04.1 LTS on the same TK1 develope board, the rate is about 30fps.
but I have another problem is i can’t change the H264 bitrate, so how to change bitrate in OpenMax.
This is the main part of OpenMax initialize:
INIT_PARAM(paramPort);
paramPort.nPortIndex = 0;
err = OMX_GetParameter(gApp.videoEncHandle, OMX_IndexParamPortDefinition, &paramPort);
CHECK_FAILED(err);
//paramPort.format.video.cMIMEType = “video/avc”;
paramPort.format.video.eCompressionFormat = OMX_VIDEO_CodingUnused;
paramPort.format.video.eColorFormat = OMX_COLOR_FormatYUV420Planar;
paramPort.format.video.nFrameWidth = inWidth;
paramPort.format.video.nFrameHeight = inHeight;
paramPort.format.video.xFramerate = framerate << 16;
//paramPort.format.video.nBitrate = 8000000;
paramPort.format.video.nStride = inWidth;
paramPort.format.video.nSliceHeight = inHeight;
paramPort.nBufferSize = inBufferSize;
err = OMX_SetParameter(gApp.videoEncHandle, OMX_IndexParamPortDefinition, &paramPort);
CHECK_FAILED(err);

INIT_PARAM(paramPort);
paramPort.nPortIndex = 1;
err = OMX_GetParameter(gApp.videoEncHandle, OMX_IndexParamPortDefinition, &paramPort);
CHECK_FAILED(err);
paramPort.format.video.cMIMEType = "video/avc";
paramPort.format.video.eCompressionFormat = OMX_VIDEO_CodingAVC;//OMX_VIDEO_CodingAutoDetect;//
paramPort.format.video.eColorFormat = OMX_COLOR_FormatUnused;
paramPort.format.video.nFrameWidth = inWidth;
paramPort.format.video.nFrameHeight = inHeight;
paramPort.format.video.xFramerate = 0;
paramPort.format.video.nBitrate = 8000000;
//paramPort.format.video.nStride = inWidth;
//paramPort.format.video.nSliceHeight = inHeight;
//paramPort.nBufferSize = outBufferSize;
err = OMX_SetParameter(gApp.videoEncHandle, OMX_IndexParamPortDefinition, &paramPort);
CHECK_FAILED(err);

{
	OMX_VIDEO_PARAM_AVCTYPE h264type;
	INIT_PARAM(h264type);
	h264type.nPortIndex = 1;
	err = OMX_GetParameter(gApp.videoEncHandle, OMX_IndexParamVideoAvc, &h264type);
	CHECK_FAILED(err);
	h264type.nAllowedPictureTypes = OMX_VIDEO_PictureTypeI | OMX_VIDEO_PictureTypeP;
	h264type.eProfile = OMX_VIDEO_AVCProfileBaseline;
	h264type.eLevel = OMX_VIDEO_AVCLevel41;
	h264type.nSliceHeaderSpacing = 0;
	h264type.bUseHadamard = OMX_TRUE;
	h264type.nRefFrames = 1;
	h264type.nBFrames = 0;
	if (h264type.nBFrames != 0){
		h264type.nAllowedPictureTypes |= OMX_VIDEO_PictureTypeB;
	}
	h264type.nPFrames = 25;
	if (h264type.nPFrames == 0){
		h264type.nAllowedPictureTypes = OMX_VIDEO_PictureTypeI;
	}
	h264type.nRefIdx10ActiveMinus1 = 0;
	h264type.nRefIdx11ActiveMinus1 = 0;
	h264type.bEntropyCodingCABAC = OMX_FALSE;
	h264type.bWeightedPPrediction = OMX_FALSE;
	h264type.bconstIpred = OMX_FALSE;
	h264type.bDirect8x8Inference = OMX_FALSE;
	h264type.bDirectSpatialTemporal = OMX_FALSE;
	h264type.nCabacInitIdc = 0;

	h264type.bEnableUEP = OMX_FALSE;
	h264type.bEnableFMO = OMX_FALSE;
	h264type.bEnableASO = OMX_FALSE;
	h264type.bEnableRS = OMX_FALSE;
	h264type.bFrameMBsOnly = OMX_TRUE;
	h264type.bMBAFF = OMX_FALSE;
	h264type.eLoopFilterMode = OMX_VIDEO_AVCLoopFilterEnable;

	err = OMX_SetParameter(gApp.videoEncHandle, OMX_IndexParamVideoAvc, &h264type);
	CHECK_FAILED(err);
}
{
	OMX_VIDEO_PARAM_BITRATETYPE bitrateType;
	INIT_PARAM(bitrateType);
	bitrateType.nPortIndex = 1;
	err = OMX_GetParameter(gApp.videoEncHandle, OMX_IndexParamVideoBitrate, &bitrateType);
	CHECK_FAILED(err);
	bitrateType.eControlRate = OMX_Video_ControlRateVariable;
	bitrateType.nTargetBitrate = 8000000;
	err = OMX_SetParameter(gApp.videoEncHandle, OMX_IndexParamVideoBitrate, &bitrateType);
	CHECK_FAILED(err);
}

Here’s a thread regarding an older version of L4T, it might work for 21.4, though: https://devtalk.nvidia.com/default/topic/815019/linux-for-tegra/tegra-k1-openmax-capabilities/