I have implemented an encoding product with Intel Media SDK 2016 R2 and sample codes.
So I have met an encoding problem in a sample code.
It is occurred an INIFINITE loop at GetFreeSurface() in sample_utils.cpp with a relatively low frequency
which is located the loop calling at GetFreeSurfaceIndex() and MSDK_SLEEP() alternately.
In this case, I have inserted a work arround as follows;
Add a number of two allocation frames at CEncodingPipeline::AllocFrames() in pipeline_encode.cpp.
nEncSurfNum = EncRequest.NumFrameSuggested; nEncSurfNum += 2;
And then, I met a different problem as follows;
An error MFX_ERR_UNKNOWN is returned from SyncOperation() at CEncTaskPool::SynchronizeFirstTask() in pipeline_encode.cpp.
which is occurred with low frequency same as Issue 1.
How can I resolve the problem with what fix I should make?
In addition, I have tested any number of times executing the sample encode with Intel Media SDK 2017 R1, then I have the same result.
In this case, I did not modify the sample codes.
The error messages as follows:
[ERROR], sts=MFX_ERR_UNKNOWN(-1), CEncodingPipeline::GetFreeTask, m_TaskPool.SynchronizeFirstTask failed at src\pipeline_encode.cpp:1445[ERROR], sts=MFX_ERR_UNKNOWN(-1), CEncodingPipeline::Run, m_pmfxENC->EncodeFrameAsync failed at src\pipeline_encode.cpp:1649[ERROR], sts=MFX_ERR_UNKNOWN(-1), wmain, pPipeline->Run failed at src\sample_encode.cpp:1027Encoding Sample Version 184.108.40.206Input file format YUV420Output video AVCSource picture:Resolution 720x480Crop X,Y,W,H 0,0,720,480Destination picture:Resolution 720x480Crop X,Y,W,H 0,0,720,480Frame rate 29.97Bit rate(Kbps) 2395Gop size 30Ref dist 0Ref number 0Idr Interval 0Target usage balancedMemory type systemMedia SDK impl swMedia SDK version 1.19Processing startedFrame number: 1Frame number: 100Frame number: 200Frame number: 258
In this case, MFX_ERR_UNKNOWN is returned from SyncOperation() at 136 line in pipeline_encode.cpp
sts = m_pmfxSession->SyncOperation(m_pTasks[m_nTaskBufferStart].EncSyncP, MSDK_WAIT_INTERVAL);
However I can not the reason why the error code is returned in this situation.
Does anyone have some information as same as this issue?
Could you provide full command line an full output log (the log you'v posted in previous message seems to be partial) ? Also, please write what version of samples you're using (what is samples' package name).
The frequency of occurrence of this bug is very low.
Sometimes occurring within 1 hour, sometimes it doesn't occur for more than 24 hours.
Full command line:
sample_encode.exe -sw -b 2395 -tff -f 29.97 -g 30 -idr_interval 0 -w 720 -h 480 -CodecProfile 100 -CodecLevel 32 -i city_720_480_2997fps.yuv -o city_720_480_2997fps.264 > stdout_stderr_%LOOP_CNT%.txt 2>&1
%LOOP_CNT% is loop counter incremented in bat file.
Full output log:
The log I have posted is full output log containing messages from stdout and stderr.
Version of samples:
IntelMSDK Samples R2 for Intel(R) Media Server Studio 2017
It was downloaded from
About intput movie file:
Download city_4cif_30fps.y4m from
Convert file format y4m to yuv.
Convert width and height 704x576 to 720x480.