Encoding issues

Encoding issues


I'm having trouble setting up the encoder. Those are the settings I'm using:
    mfxVideoENCODE = new MFXVideoENCODE((mfxSession)mfxVideoSession);
    auto param = shared_ptr<mfxVideoParam>(new mfxVideoParam);

    mfxInfoMFX mfx = param->mfx;
    mfx.CodecId = MFX_CODEC_AVC;
    mfx.CodecProfile = MFX_PROFILE_AVC_BASELINE;
    mfx.TargetKbps = 2899;
    mfx.EncodedOrder = 0;

    auto frameInfo = mfx.FrameInfo;
    frameInfo.FourCC = MFX_FOURCC_NV12;
    frameInfo.Width = 896;
    frameInfo.Height = 480;
    frameInfo.CropX = 0;
    frameInfo.CropY = 0;
    frameInfo.CropW = 854;
    frameInfo.CropH = 480;
    frameInfo.FrameRateExtN = 24;
    frameInfo.FrameRateExtD = 1;
    frameInfo.ChromaFormat = MFX_CHROMAFORMAT_YUV420;

MFXVideoENCODE_Query call returns -6 (MFX_ERR_INVALID_HANDLE).

MFXQueryIMPL returns 0 and impl contains 1026 (MFX_IMPL_HARDWARE | MFX_IMPL_VIA_RESERVED1).

Moreover - when trying to run sample "sample_decode_drm" (using provided binary, with commandline: ./sample_decode_drm h264 -i file.avi -hw -o video.yuv), I get the following:

libva info: VA-API version 0.34.0
libva info: va_getDriverName() returns 0
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/iHD_drv_video.so
libva info: Found init function __vaDriverInit_0_32
libva info: va_openDriver() returns 0

Return on error: error code -3,    /msdk/validation/linux_val/validation/ww29.5_Linux-HSW_vc54_Ubuntu_12.04/samples/sample_decode/src/pipeline_decode.cpp    215

Return on error: error code -3,    /msdk/validation/linux_val/validation/ww29.5_Linux-HSW_vc54_Ubuntu_12.04/samples/sample_decode/src/pipeline_decode.cpp    627

Return on error: error code 1,    /msdk/validation/linux_val/validation/ww29.5_Linux-HSW_vc54_Ubuntu_12.04/samples/sample_decode/src/sample_decode.cpp    279

Segmentation fault (core dumped)

Any ideas what could be wrong?

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

First, you'll want to check your installation.  See install steps here for more info: http://software.intel.com/en-us/forums/topic/472852

Second, container formats (like avi) are not supported by Media SDK.  Media SDK only works with elementary stream formats like h264 and mpeg2.  You'll need to demux your input first.  There are many tools to do this, but it should be possible with something like 

ffmpeg -i file.avi -vcodec copy -an -f h264 file.264

Ok, SDK is not installed correctly.

"Error... Kernel module updated failed, due to mismatched kernel 3.8.0-30-generic with pre-build KMD. You have to rebuild kernel with patched files (kmd/source) manually."

When trying to build patched sources (v3.2), i get the following error:
"drivers/gpu/drm/i915/i915_dma.c:37:29: fatal error: linux/intel_ips.h: No such file or directory"
Which dependency am I missing?
Also, would it work with 2nd gen Core processor (i5-2520M)?
"00:02.0 VGA compatible controller [0300]: Intel Corporation 2nd Generation Core Processor Family Integrated Graphics Controller [8086:0126] (rev 09)"

Hi, For the product/OS you are using, there is no support (or license) for use on 2nd Generation Core Processors,

I've switched to 3gen CPU, followed installation instructions and it went well (install_media.sh completed succesfully - without the need to compile patched kernel manually).
"uname -aa" yields: "Linux ubuntu 3.2.0-41-generic #66-Ubuntu SMP Thu Apr 25 03:27:11 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux"
"lsmod" shows module "i915", used by 2 other modules (unlisted)
Sample_decode_drm works ok (side note for anyone interested: if you're using Big Buck Bunny MOV, you need to add "-bsf h264_mp4toannexb" switch to ffmpeg's command line).
But my attempts to initialize encoder still fails (MFXVideoENCODE_Query, MFXVideoENCODE_Init, MFXVideoENCODE_GetVideoParam all returns -6 /*MFX_ERR_INVALID_HANDLE*/).

Can you provide information on the specific "3gen CPU" you are using?

Is this seen with the unmodified "sample_encode_drm" sample?


It's [Intel® Core™ i7-3820QM CPU @ 2.70GHz × 8]
Both [sample_decode_drm] and [sample_encode_drm] works fine (I was able to play the file after transcoding) - even when running 3.8 kernel (is it really unsupported? - my Intel Centrino Advanced-N 6230 doesn't work on 3.2).
I'm trying to initialize encoder in my own app (see attached files - btw. you could whitelist "hpp" extension).


Downloadtext/x-c++src encoder.cpp1.76 KB
Downloadtext/x-chdr encoder.h288 bytes

Sorry for the delay in replying.  You've probably already found the answer elsewhere, but if not I just wanted to point out that the code attached appears to have the same problem as in this thread:http://software.intel.com/en-us/forums/topic/479998

While a video device handle is sometimes required for Windows, it is always required for Linux.

Linux ubuntu 3.8.0-19-generic #29-Ubuntu SMP Wed Apr 17 18:16:28 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux

INFO... Install on Ubuntu ...
INFO... Installing New Driver...
INFO... The default media driver is renderless API, do you want to use X11 backend?
press 'y' to use X11 backend, otherwise by default(drm backend, renderless)y
INFO... X11 backend enabled!
INFO... MediaSDK installed successfully in /opt/intel/mediasdk!
INFO... Do you want to install KMD?
press 'y' to confirm, otherwise cancelled.y
INFO... Original i915.ko backuped in kmd_backup/i915.ko.2014-04-24_150214
INFO... Trying to install 3.2.42 kmd...
Error... Kernel module updated failed, due to mismatched kernel 3.8.0-19-generic with pre-build KMD. You have to rebuild kernel with patched files (kmd/source) manually.
INFO... Package installation Done.

cpu info: Intel(R) Core(TM) i7-3770 CPU @ 3.40GHz


Media SDK for Linux Servers has a patched i915 graphics driver module which must match specific kernel versions/configs.

For Ubuntu, installing the right kernel and headers for your hardware is a required prerequisite.

  • For Ivybridge/3rd Generation Core processors: apt-get install linux-image-3.2.0-41-generic linux-headers-3.2.0-41-generic
  • For Haswell/4th Generation Core processors: apt-get install linux-image-3.8.0-23-generic linux-headers-3.8.0-23-generic

After this step the install script should work.

Leave a Comment

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