NOTICE: The Processors Wiki will End-of-Life in December of 2020. It is recommended to download any files or other content you may need that are hosted on The site is now set to read only.


From Texas Instruments Wiki
Jump to: navigation, search

MPEG4 Encoder: Frequently Asked Questions

Version: 1.0

MPEG4 Encoder general queries


What is the profile supported? What is the max resolution supported?

Only simple profile encoding is supported. The max resolution supported is D1 (NTSC/PAL).

Does MPEG4 Encoder support non-multiple of 16 frame height and width?

Yes, the MPEG4 Encoder supports encoding of video with non multiple of 16 resolutions. The only constraint is that the height and width should be multiple of 2 (this comesfrom the YUV 420 chroma format requirements).

What are the recommended buffer sizes for input and output buffers?

Input Buffer:

The input (YUV input) buffer size is fixed based on the input resolution needed. It is height*width*1.5 for YUV 420 and height*width*2 for YUV 422 inputs.

Output Buffer:

The output buffer (stream buffer) size is based on the worst case compression ratio (which depends on how though the content is for encoding). For typical streams we recommend output buffer size of height*width/2 (this assumes worst case compression ratio of 1:3).

What are the input formats supported ?

The encoder supports the following chroma formats :

YUV420 planar

YUV422 interleaved little endian (UYVY…)

YUV422 interleaved BIG endian (YVYU..)

What are the output formats supported ?

The encoder supports only XDM_BYTE Format

What are the error resiliency tools supported by MPEG4 Encoder ?.

The encoder supports the following Error resiliency tools:

DP (Data Partitioning)

RVLC(Reversible VLC)

Resync Markers

MIR (Mandatory intra refresh)

HEC(Header extension code)

Does the encoder use H263 encoding?

Yes, the encoder supports short header format encoding (by setting the encodingMode parameter to 0). This generates bit stream compliant to H263 standard.

What are the levels supported for H263?

The encoder supports H263 Baseline profile, level 10/20/30/45.

The encoder returns error when creating the algorithm instance, what could be the possible reason?.

Typically the encoder returns an error if any of the create time parameters given is not supported or a parameter is set to a value outside the allowed range. The allowed range for each parameter can be checked in the user guide.

The process call (encode call) returns error, what could be the cause?

Check if any of the dynamic parameter is set to a wrong value (un supported value or value outside the allowed range, check the userguide for the allowed range).

Check if the input and output buffer pointers are valid and non NULL

The encoder gives out corrupted stream for a given YUV what could be the cause?

Check the output buffer size. The buffer size may not be sufficient. Increase it and check.

Does the encoder support XDM_GENERATE_HEADER feature?

If the parameter generateHeader is set to XDM_GENERATE_HEADER, then the encoder can generate only the VOL/VOSS header (the data will not be encoded). Setting this flag to XDM_ENCODE_AU will generate the encoded stream with both headers and compressed data.

What are the additional features supported by the MPEG4 Encoder?

Motion vector access: The MPEG4 Encoder optionally allows the access to the motion vectors and SSE (or SAD) for each MB in a frame (through MVDataEnable flag). If enabled, the encoder expectes a buffer pointer (as input) to store the Motion vector data (MVx, MVy and SSE).

Insertion of End of sequence: The MPEG4 encoder can optionally insert EOS (end of sequence) into the bit–stream (to signal the sequence end) if lastFrameFlag is enabled.

Does the encoder support interlaced content?

No. the encoder supports only progressive content.

Does the encoder support AC prediction?

Yes, this AC prediction can be turned on optionally.

How does the encoder support packetization?

The packaetization is supported through resyncInterval parameter. The packet size is <= resyncInterval. resyncInterval indicates number of bits per packet. This parameter can be changed run-time.

Does the encoder support sub-frame level encode call/API’s?

No, the encoder support only frame level encode API’s

Does the encoder support any pre or post processing algorithms?

No, the encoder does not support any pre or post processing algo’s.

How does setting/changing the target fps at run-time affect encoding? If target fps is set to 15 fps but data is sent at 30 fps will the behavior be any different than if the target fps was set to 30 fps?

The encoder expects the same input frame rate and target frame rate. Otherwise it gives an error. This means that the fps in the above example should be same for input and target framerate’s. The encoder does not support any frame rate conversion. But the frame rate can be changed dynamically at run time (with the condition that input and target frame rate should be same).

MPEG4 Encoder video quality related queries

What are the parameters that affect the encoder quality?

There are many parameters that affect the encoded video quality: The main parameters are: Bit rate, frame rate, search range, UMV, sub-pixel (halfpel) ME, rate control algo. There are other parameters as well such as I frame interval that affect the quality.

What is encodingPreset and how it should be set?

Encoding preset is a create-time option in the video encoder. Typically there are two presets in the codec (Not available in all platforms).

High Quality – This setting offers the best possible encoding. It also has the highest complexity.

High Speed – This setting has lower complexity than the high quality setting. Reduced complexity is achieved by making compromises in the encoder search operations.

The high speed version is available only on 64x+ MPEG4 Encoder. The default is the high quality setting. For other versions of the encoder, only the default value of HIGH_QUALITY is supported.

How is the GOP(group of picture) Structure configured?

The encoder offers the ability to choose the GoP size using a parameter called IntraFrameInterval. Using IntraFrameInterval = N > 1: This generates GoPs with the structure IPPPPPP (P repeated N-1 times). The advantage of this structure is that there are periodic sync points at the I-frames. Hence a decoder can start decoding a sequence within N-frames of any desired “seek” point. One disadvantage in this scheme is that there are high bit-rate variations (Max/Avg). In general, the recommended value of N is equivalent of 1 sec (ex: 30 if the stream is at 30fps). Using IntraFrameInterval = 0 implies that the encoder should generate only one I-frame in the beginning of sequence. In addition to this, while encoding it is also possible to force a frame to be an I frame by setting the forceIFrame flag to 1.

What are the rate control algorithms supported?

The rate control algorithms. The rate control algorithm used in the encoder can be chosen in two ways. The base class parameter RateControlPreset or rcAlgo option (available via extended class).

Low delay (CBR):Uses an algorithm called PLR3. In this mode, frames may be dropped when the bit-rate is less and the content and buffer conditions demand it.

Storage (VBR): Uses an algorithm called PLR4. This does not skip frames and is suitable for storage kind of applications.

The rate control can also be chosen via rcAlgo parameter.

What are the parameters affecting the motion estimation.

The search range which is derived from fCode parameter. The enableUMV parameter that allows ME search outside the picture boundary. Enabling half pel motion estimation: some platforms have the flexibility to switch on/off the half pel motion estimation (only available in 64x+ MPEG4 Encoder. Other versions have halfpel estimation enabled by default). Intraframe interval of 1 sec is also recommended for good quality.

The encoded content looks blocky, what could be the reason?

Typically this is due to insufficient bit rate. Tough to encode content with many scene changes or with a lot of details in it needs higher bit rate for better quality.