lowest latency encode possible

lowest latency encode possible

Hi there,

How can I achieve the lowest possible encode latency for 1366x768 or 1920x1080 source content that is generated on the fly at 30-60fps? I have used all the settings I saw in the low latency tutorial:

    // Configuration for low latency
    mfxEncParams.AsyncDepth        = 1;
    mfxEncParams.mfx.GopRefDist = 1;

    mfxExtCodingOption extendedCodingOptions;
    memset(&extendedCodingOptions, 0, sizeof(extendedCodingOptions));
    extendedCodingOptions.Header.BufferId        = MFX_EXTBUFF_CODING_OPTION;
    extendedCodingOptions.Header.BufferSz        = sizeof(extendedCodingOptions);
    extendedCodingOptions.MaxDecFrameBuffering    = 1;
    mfxExtBuffer* extendedBuffers[1];
    extendedBuffers[0]            = (mfxExtBuffer*)&extendedCodingOptions;
    mfxEncParams.ExtParam        = extendedBuffers;
    mfxEncParams.NumExtParam    = 1;
    // ---

Also, there is a vpp color conversion from RGB4 to NV12 before the encode.

Right now, my timing indicates that SyncOperation takes 20ms on average, which seems very slow for the HD Graphics 4000??  Also, using GPA shows that the "Media Performance" is not near full utilization.  The encoded content is needed in real time.  Do you have any suggestions for speeding things up?  


3 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

Hi Sam,

Right, 20ms is a bit much. On an Intel  3rd generation Core Processor using recent graphics driver (such as 15.31.3071), you should be getting ~10ms or less (for 1080p) for the pipeline you describe, VPP(RGB4 to NV12) -> H,264 Encode.

The configuration as you stated is enough to achieve low latency. But also make sure to set VPP AsyncDepth = 1.

Other things that will increase latency is if you use system memory surfaces instead of D3D surfaces.

You can easily create a VPP-Encode pipeline by slightly modifying the "simple_6_encode - d3d - vpp_preproc" sample from the Media SDK Tutorial. The only thing you will have to add to that sample is the low latency configuration and latency benchmarking (if you wish) from the "simple_6_encode - d3d - lowlatency" sample.


Hi Petter,

It turned out that changing AsyncDepth = 2 to AsyncDepth = 1 now gets me latencies below 10ms.  Thanks!  I did not expect this since I was calling Encode and then Sync one right after the other.  I guess there is some buffering/deferred processing that happens in the SDK when AsyncDepth > 1?


Leave a Comment

Please sign in to add a comment. Not a member? Join today