Hy,
Hy, I tried to use the simple_encode example in a linux environmet. Everything is compiling fine but when I start the software it always stops at the function MFXVideoENCODE_Init with the error code: MFX_ERR_NOT_INITIALIZED. How can I solve that? I've added the sourcecode in the attachment.
One thing, that might cause the problem is, that I wasn't able to link the libmfx.a. I used the dynamic library libmfxhw64.so which compliled fine. I also tried to link the libmfx.a but that gave me the errors as you can see in compileOutput.txt.
Thanks in advance
Clemens
链接已复制
Hi Clemens,
There are not many differences between Media SDK for Linux and Windows, but you have run into one of them. For Windows, passing a HW device handle to MSDK is only required when using GPU memory. For Linux this step is required for ALL Media SDK applications.
The code should look something like this:
mfxIMPL impl = MFX_IMPL_HARDWARE_ANY;
mfxVersion ver = { 0, 1 };
MFXVideoSession session;// Initialize Intel Media SDK Session
sts = session.Init(impl, &ver);// Create VA display
int fd = open("/dev/dri/card0", O_RDWR);
VADisplay va_dpy = vaGetDisplayDRM(fd);
int maj_ver, min_ver;
vaInitialize(va_dpy, &maj_ver, &min_ver);// Provide VA display handle to Media SDK
session.SetHandle(static_cast < mfxHandleType >
(MFX_HANDLE_VA_DISPLAY), va_dpy);
While it is possible to compile with gcc it will take some modifications from the code you've attached. g++ will be an easier starting point.
In case it might help I've added a reference makefile below.
EXEC=simple_session
SRCS=simple_session.cppCFLAGS=-I/usr/local/include -I$(MFX_HOME)/include
LFLAGS=-L$(MFX_HOME)/lib/lin_x64 -lmfx -ldl -lpthread -lva -lva-drm -lstdc++$(EXEC): $(SRCS) Makefile
g++ -o $(EXEC) $(SRCS) $(CFLAGS) $(LFLAGS)
We are working on more documentation and simple examples for Linux. Please stay tuned.
