Media (Intel® Video Processing Library, Intel Media SDK)
Access community support with transcoding, decoding, and encoding in applications using media tools like Intel® oneAPI Video Processing Library and Intel® Media SDK
Announcements
The Intel Media SDK project is no longer active. For continued support and access to new features, Intel Media SDK users are encouraged to read the transition guide on upgrading from Intel® Media SDK to Intel® Video Processing Library (VPL), and to move to VPL as soon as possible.
For more information, see the VPL website.

Unknown error when using look ahead rate control

Krist
Beginner
442 Views

I wish to use look ahead rate control. When I select that option, and execute the encoder "Query" function, the result is successful. But when I then call the Init function, an "unknown error" (-1) is returned.

Can someone please explain this error to me?

I am on a Linux environment, using an Intel(R) Core(TM) i7-4790T CPU @ 2.70GHz

0 Kudos
1 Solution
Jeffrey_M_Intel1
Employee
442 Views

Sorry for the delayed reply.  I can reproduce the segfault and will file a bug.  

To get beyond the crash you will want to drain the encoder as described in the manual's "configuration change" section. 

View solution in original post

0 Kudos
5 Replies
Jeffrey_M_Intel1
Employee
442 Views

Are you able to use lookahead BRC from one of the prebuilt samples?

./sample_multi_transcode_drm -i::h264 ../content/test_stream.264 -o::h264 test.h264 -hw -la

If yes, then the next place to look is likely to be in your application code.  If you also get the error with the prebuilt samples the issue is likely to be related to your installation.  Several kernel, i915, libdrm, and libva changes have to align to use the full range of Media SDK features in Linux.  Not having the right version of any of them can cause this kind of error to happen.  Versions can change due to other software installs.  Going through the install procedure from the Getting Started Guide again may be a quick way to get you going.

0 Kudos
Krist
Beginner
442 Views

Hi Jeffrey,

I am able to run the sample without any issues. I made some fixes to my environment and now the Init is also working in my application.

However, when I try to encode a frame using RATECONTROL_LA or RATECONTROL_LA_HRD, the program crashes. The crash appears to originate from an intel library.

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fffeaf21700 (LWP 4229)]
0x00007fffe2afcea4 in CmSurface2D_RT::GetSurfaceHandle() ()
   from /opt/intel/common/mdf/lib64/igfxcmrt64.so
(gdb)
(gdb) bt
#0  0x00007fffe2afcea4 in CmSurface2D_RT::GetSurfaceHandle() ()
   from /opt/intel/common/mdf/lib64/igfxcmrt64.so
#1  0x00007fffe2af48c2 in CmDevice_RT::CreateVmeSurfaceG7_5(CmSurface2D*, CmSurface2D**, CmSurface2D**, unsigned int, unsigned int, SurfaceIndex*&) () from /opt/intel/common/mdf/lib64/igfxcmrt64.so
#2  0x00007fffeb005ff6 in ?? () from /opt/intel/mediasdk/lib64/libmfxhw64-p.so.1.16
#3  0x00007fffeaff7200 in ?? () from /opt/intel/mediasdk/lib64/libmfxhw64-p.so.1.16
#4  0x00007fffeaff7985 in ?? () from /opt/intel/mediasdk/lib64/libmfxhw64-p.so.1.16
#5  0x00007fffeafbc47d in ?? () from /opt/intel/mediasdk/lib64/libmfxhw64-p.so.1.16
#6  0x00007fffeb3ec507 in ?? () from /opt/intel/mediasdk/lib64/libmfxhw64-p.so.1.16
#7  0x00007ffff7704182 in start_thread (arg=0x7fffeaf21700) at pthread_create.c:312
#8  0x00007ffff465647d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:111

 

0 Kudos
Jeffrey_M_Intel1
Employee
442 Views

Thanks for the additional info.  If the sample runs with the command line above (including -la), then the next step is to look at your application.

The tutorials can be a simpler starting point for code examples. https://software.intel.com/en-us/intel-media-server-studio-support/training.

If you switch the rate control of one of the tutorials (such as simple_5_transcode_vmem) to MFX_RATECONTROL_LA do you see similar behavior?  Where is your application different?  If you can reproduce the behavior in simple code you can share, or with small modifications to the sample or tutorial code it will be much easier for us to get to the root cause of the segfault.

BTW, which Linux are you working with?  CentOS 7.1 or a different distro?  Which kernel are you using?

Thanks, Jeff

 

 

0 Kudos
Krist
Beginner
442 Views

Hello Jeffrey,

I have found what causes this issue. It appears that a call to the encoder "Reset" function is causing the crash when using MFX_RATECONTROL_LA or MFX_RATECONTROL_LA_HRD. I have to call the Reset function of the encoder a lot, since I am constantly changing the bitrate on the fly.

This is very easily reproducable, the tutorial "simple_3_encode_vmem" can be adjusted as follows:

102:    mfxEncParams.mfx.RateControlMethod = MFX_RATECONTROL_LA;

And after encoding a few frames, call the Reset after the SyncOperation.

237:   +    if (nFrame == 25) { mfxENC.Reset(&par) }

Execute, and it will crash. You can also see that if you change the ratecontrol back to MFX_RATECONTROL_VBR, it is not crashing.

 

I am working on Linux Mint 17.1 Rebecca. The kernel I use is the recommended 3.14.5, with the kernel mod patches as described in the Getting Started Guide.

0 Kudos
Jeffrey_M_Intel1
Employee
443 Views

Sorry for the delayed reply.  I can reproduce the segfault and will file a bug.  

To get beyond the crash you will want to drain the encoder as described in the manual's "configuration change" section. 

0 Kudos
Reply