sample_encode h265 fails

sample_encode h265 fails

I am trying to use sample_encode.exe binary to generate h265 output and I am getting errors.
I am using the sample video file from your web site (176x96) renamed as 176_96.yuv
This works (and generates correct output):

     sample_encode h264 -i 176_96.yuv -o 1.264 -w 176 -h 96

This fails:

      sample_encode h265 -i 176_96.yuv -o 1.265 -w 176 -h 96
      Return on error: error code -3, .\src\pipeline_encode.cpp       530
      Return on error: error code -3, .\src\pipeline_encode.cpp       1061
      Return on error: error code -3, .\src\pipeline_encode.cpp       991
      Return on error: error code 1,  .\src\sample_encode.cpp 420

This also fails:

       sample_encode h265 -hevc_encoder_plugin 1 -i 176_96.yuv -o 1.264 -w 176 -h 96
       Return on error: error code -9, .\src\pipeline_encode.cpp       952
       Return on error: error code 1,  .\src\sample_encode.cpp 420

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


Support for H.265 (HEVC) is not built into the library that comes with "Intel Media SDK 2014 for Clients".  Instead it is supported as a "plug-in" to the architecture.  The "Intel® Media SDK 2014 HEVC Software Pack" is sold separately, but you can download a 30-day trial from the "Media Solutoins Portal"   ( ).

Once the plug-in is installed, the Media SDK API (and sample_encode ) can be used.


I have done that. I installed Intel® Media SDK 2014 HEVC Software Pack, which in turned installed the 2014 Media SDK.

I am running sample_encode.exe from C:\Program Files\Intel\Media SDK 2014 HEVC Software Pack Evaluation\samples\sample_encode\win32

I am getting a slightly different error from sample_decode.exe using the test_stream.265 file that you posted on your web site

What am I doing wrong? What is the correct command line for encoding?

Sorry, I should have mentioned in first response...

When you use the 'h265' parameter, you also need to use the "-hevc_encoder_plugin 1" parameter.

sample_encode.exe h265 -hevc_encoder_plugin 1 -i 176_96.yuv -o 1.265 -w 176 -h 96

There is a "readme-encode" document in the "sample_encode" folder that mentions this.

Also, If you are using the 64-bit version of the "sample_encode" in the default installation location ("C;\Program Files\Intel\...") the location is only allows writing of files with administrator privileges.  This would affect all codecs, but it is may be cause of other issue you are seeing.


I already tried adding "-hevc_encoder_plugin 1" to the command line. As you can see in my original post, it still fails, although the error is slightly different:

 sample_encode h265 -hevc_encoder_plugin 1 -i 176_96.yuv -o 1.264 -w 176 -h 96
       Return on error: error code -9, .\src\pipeline_encode.cpp       952
       Return on error: error code 1,  .\src\sample_encode.cpp 420

I only tried the 32-bit version of the encoder. And it is not a problem creating files, because I can create H264 files in the sample place.

After stepping through the sample_encode source code, when I run it with this command line:
    sample_encode h265 -hevc_encoder_plugin 1 -i 176_96.yuv -o 1.264 -w 176 -h 96
The sample fails quickly on this line with -9:

if (pParams->IsUseHEVCEncoderPlugin)
   sts = MFXVideoUSER_Load(m_mfxSession, &m_UID_HEVC, pParams->HEVCPluginVersion);

MFXVideoUSER_Load doesn't even seem to look for the plugin DLL. I ran Process Monitor, which allows you to see which files or registry entries are accessed, and there is no attempt to load the plugin DLL or any of the registry settings containing its location.

I would expect you to look for HKEY_LOCAL_MACHINE\SOFTWARE\Intel\MediaSDK\Plugin\{2fca9974-9fdb-49ae-b121-a5b63ef568f7} to find the DLL location and then try to load the DLL. I am not sure what is wrong, since I can't find the source for MFXVideoUSER_Load anywhere.

Bah. I found out the error was caused by an older version of libmfxsw32.dll (version 1.6). And the HEVC plugin requires version 1.8, so it wasn't loaded. And since the error occurred when the session was created, I didn't see that anything went wrong.

It's good that you gave us the source for the libmfx library. So, false alarm - it's working now (both encode and decode).

hi,i encounter the same issue as you, could you pass me the effective libmfxsw32.dll file? thanks!


Hi, please notice that Intel® Media SDK 2014 R2 for Clients with API 1.9 is now available on Media Solutions Portal.

The libmfxsw32.dll that was part of Intel® Media SDK 2014 for Clients added support for API 1.8.

We recommended that all new development use the latest SDK, but if you are using newer features this is an understandable requirement.

hi, tony

follow your instruction,install 2014 media SDK but not 2013 version is OK now, thanks.





Is there a way to output the encoded bitstream in the sample_hevc_gaa application ? 

I also have problem with sample_encode. I use trial version of "Intel(R) Media Server Studio 2017" and sample files from "Samples for Intel(R) Media Server Studio 2017 for Windows". Now I want to use software encoding. Thus I changed pParams->bUseHWLib in sample_decode.cpp:
// set default implementation
pParams->bUseHWLib = false;

sample_encode.exe h265 -i test_stream_176x96.yuv -o test_stream.265 -w 176  -h 96 -sw

I got the following error:
ERROR: No free surfaces in pool (during long period)
Return on error: error code -4, src\pipeline_encode.cpp 1443
Return on error: error code 1,  src\sample_encode.cpp   903

If I use sample_encode with h264 parameters like
sample_encode.exe h264 -i test_stream_176x96.yuv -o test_stream.264 -w 176  -h 96 -sw
it works fine.

What is wrong with software h265 encoder?


Leave a Comment

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