Media (Intel® oneAPI Video Processing Library, Intel Media SDK)
Access community support with transcoding, decoding, and encoding in applications using media tools from Intel. This includes Intel® oneAPI Video Processing Library and Intel® Media SDK.
This community is designed for sharing of public information. Please do not share Intel or third-party confidential information here.

MPEG2 encoder memory consumption



I have implemented a server that grabs the desktop vi a mirrordriver, encodes and sends out the stream to the network.

I have uptill now used the H264, but have problems getting a low latency. I have followed all the recommandations in the videoconference sample with no sucess.

I therefore tried the MPEG2 encoding option, to see if there was any difference in the latency. Surpsrisingly there was a big difference.

The only difference for MPEG2/H264 in the settings are:

for H264

	    mfxEncParams.mfx.CodecId                    = MFX_CODEC_AVC;
	    mfxEncParams.mfx.CodecProfile               = MFX_PROFILE_AVC_HIGH;
	    mfxEncParams.mfx.CodecLevel                 = MFX_LEVEL_AVC_5;

for MPEG2

	    mfxEncParams.mfx.CodecId                    = MFX_CODEC_MPEG2;
	    mfxEncParams.mfx.CodecProfile               = MFX_PROFILE_MPEG2_HIGH;
	    mfxEncParams.mfx.CodecLevel                 = MFX_LEVEL_MPEG2_HIGH;

As I mentioned the latency is much lower with the MPEG2 than the H264. I would happily stick to the MPEG2, as it does not seem to use much more network badwidth etc, compared to the H264, with the low latency setting.

I would happily use the MPEG2 encoding, BUT there is another difference.

The problem is that when using the MPEG2, it eats memory. When using the H264, it does not eat memory. (the only difference is the settings as shown above) I have tested with the 2014 version of libmfxsw32.dll, with the same result. I have an Intel HD graphics 4000  card with a driver date of 31.10.2013, version I have searched the forum as well for solutions, but have not found any sofar.

Are there known memory issues with the MPEG2 encoding, or could there be some settings that could effect it?





0 Kudos
1 Reply

Hi Jan-Erik,

Using MPEG2 for low latency may be sufficient for your needs, but I'd like to point out that the Intel Media SDK MPEG2 codec is not as optimized for video conferencing (incl. memory usage) usages and latency as the H.264 codec.

Using H.264 you should be able to get to a very low latency. Not sure why you're not achieving this in your setup.  Can you please provide more details about your implementation such as the complete H.264 encoder config (you can fetch this using the Media SDK tracer tool).

Is the long latency you're observing attributed to just the encoder operation? Or is it possibly due to delays in screen capture, color space conversion or network streaming? What is the measured frame encode latency for a specific workload?

As far as memory usage is concerned. In the current Media SDK releases, MPEG2 encode does require more RAW frame surfaces compared to H.264 encode for video conferencing scenarios.   QueryIO should tell you it needs 1 surface for H.264 and it will likely give you 5 or more when using MPEG2.

We'll explore if there are any straightforward memory optimization opportunities for MPEG2 for future releases of the SDK.   However, no guarantees.