intel / gstreamer-media-SDK

GNU Lesser General Public License v2.1
90 stars 53 forks source link

[windows ]build with meson: can't find mfx dependency #144

Closed boxerab closed 5 years ago

boxerab commented 5 years ago

I am using the topic_linux_and_windows branch.

I run a Visual Studio command prompt, and I run

set PKG_CONFIG_PATH=%GSTREAMER_1_0_ROOT_X86_64%lib\pkgconfig

Then, using meson with command

meson gstreamer-media-SDK gstreamer-media-SDK-build --backend=vs2017

I get the following output:

The Meson build system Version: 0.49.0 Source dir: c:\Users\aaron\src\gstreamer-media-SDK Build dir: c:\Users\aaron\src\gstreamer-media-SDK-build Build type: native build Project name: gst_mfx Project version: 2.0.2 Native C compiler: cl (msvc 19.16.27025.1) Native C++ compiler: cl (msvc 19.16.27025.1) Build machine cpu family: x86 Build machine cpu: x86 Found pkg-config: C:\bin\pkg-config\bin\pkg-config.EXE (0.28) Dependency glib-2.0 found: YES 2.54.3 Dependency gobject-2.0 found: YES 2.54.3 Dependency gio-2.0 found: YES 2.54.3 Dependency gmodule-2.0 found: YES 2.54.3 Dependency gstreamer-1.0 found: YES 1.14.4 Dependency gstreamer-base-1.0 found: YES 1.14.4 Dependency gstreamer-video-1.0 found: YES 1.14.4 Dependency gstreamer-allocators-1.0 found: YES 1.14.4 Dependency gstreamer-pbutils-1.0 found: YES 1.14.4 Found CMake: C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.EXE (3.12.18081601-MSVC_2) Dependency mfx found: NO (tried pkgconfig and cmake) DEPRECATION: Project targetting '>= 0.36.0' but tried to use feature deprecated since '0.48.0': python3 module Library mfx found: YES Library legacy_stdio_definitions found: YES Library d3d11 found: YES Library gdi32 found: YES Library shcore found: YES Dependency gstreamer-gl-1.0 found: YES 1.14.4 Has header "GL/glext.h" : NO Configuring version.h using configuration Library dxgi found: YES Library dxguid found: YES Build targets in project: 2 WARNING: Deprecated features used:

ishmael1985 commented 5 years ago

Can you check if MSDK is indeed working on your Windows 10 system by running MSDK sample apps?

boxerab commented 5 years ago

Thanks. What is the best way of testing this ?

boxerab commented 5 years ago

This is running on a KVM VM, by the way. Host is 8th Gen i7

ishmael1985 commented 5 years ago

https://github.com/Intel-Media-SDK/samples

boxerab commented 5 years ago

Thanks, Is there a sample h264 file that is supported, that I can test on ?

boxerab commented 5 years ago

I get these errors when I try the sample decoder in software mode:

[ERROR], sts=MFX_ERR_MORE_DATA(-10), CDecodingPipeline::InitMfxParams, m_FileReader->ReadNextFrame failed at c:\users\aaron\documents\intel« media sdk 2018 r2 - media samples 8.4.27.378\sample_decode\src\pipeline_decode.cpp:666

[ERROR], sts=MFX_ERR_MORE_DATA(-10), CDecodingPipeline::Init, InitMfxParams failed at c:\users\aaron\documents\intel« media sdk 2018 r2 - media samples 8.4.27.378\sample_decode\src\pipeline_decode.cpp:408

[ERROR], sts=MFX_ERR_MORE_DATA(-10), wmain, Pipeline.Init failed at c:\users\aaron\documents\intel« media sdk 2018 r2 - media samples 8.4.27.378\sample_decode\src\sample_decode.cpp:686
ishmael1985 commented 5 years ago

Can you run sample_decode in hardware mode and use a proper H264 elementary stream? In GStreamer you can generate an H264 elementary stream with the following pipeline:

gst-launch-1.0 filesrc location=/path/to/video.mp4 ! qtdemux ! h264parse ! 'video/x-h264, stream-format=byte-stream' ! filesink location=/path/to/video.h264

boxerab commented 5 years ago

Thanks. I am getting errors from that pipeline.

boxerab commented 5 years ago
(gst-launch-1.0:7036): GStreamer-CRITICAL **: gst_element_make_from_uri: assertion 'gst_uri_is_valid (uri)' failed
WARNING: erroneous pipeline: syntax error
boxerab commented 5 years ago

I had to remove the quotes around video/x-h264 ... and put it into software mode, and then decode ran without error.

ishmael1985 commented 5 years ago

Show me the output.

boxerab commented 5 years ago

After running pipeline, I was able to run sample_decode:

C:\Users\aaron\Documents\Intel® Media SDK 2018 R2 - Media Samples 8.4.27.378\_bin\x64>sample_decode.exe h264 -sw -i c:\temp\video.h264 -o test.yuv
pretending that aspect ratio is 1:1
Decoding Sample Version 8.4.27.378

Input video     AVC
Output format   NV12
Input:
  Resolution    1280x720
  Crop X,Y,W,H  0,0,0,0
Output:
  Resolution    1280x720
Frame rate      23.98
Memory type             system
MediaSDK impl           sw
MediaSDK version        1.27

Decoding started
Frame number: 3346, fps: 85.405, fread_fps: 0.000, fwrite_fps: 262.0000
Decoding finished
ishmael1985 commented 5 years ago

Run it in hardware mode instead of software mode, i.e. -hw instead of -sw, and show me the output.

boxerab commented 5 years ago

This is a VM, btw.

Output is

[ERROR], sts=MFX_ERR_UNSUPPORTED(-3), CDecodingPipeline::Init, m_mfxSession.Init failed at src\pipeline_decode.cpp:309

[ERROR], sts=MFX_ERR_UNSUPPORTED(-3), wmain, Pipeline.Init failed at src\sample_decode.cpp:686
boxerab commented 5 years ago

So, hardware decode not supported.

boxerab commented 5 years ago

So, it looks like MSDK is installed correctly.

boxerab commented 5 years ago

But MFX dependency is not found.

ishmael1985 commented 5 years ago

Yes, and the gst-mfx plugins behaved as expected for your case. MSDK doesn't support a virtualized environment.

boxerab commented 5 years ago

Wait, so gst-mfx doesn't support software decode ?

boxerab commented 5 years ago

And that is why MFX dep is not found ?

boxerab commented 5 years ago

Because MSDK did work in software mode on my VM

ishmael1985 commented 5 years ago

No, only hardware decode. For SW decode better use gst-libav. For the MFX dependency not being found, that was meant for building the gst-mfx plugins using open source MSDK in Linux with pkgconfig. For Windows it is not supported so that message came up for you but MFX library was found nevertheless.

boxerab commented 5 years ago

Thanks. I will test on Skylake, bare metal system. It would be nice to be able to run plugin in software mode, for testing purposes :)

boxerab commented 5 years ago

Also, it would be helpful to disable this message of MFX not found on Windows.

boxerab commented 5 years ago

I have a Skylake system with AMD discrete video card. Will I be able to use the iGPU on the CPU for this system ?

ishmael1985 commented 5 years ago

You should be able to but let me know what you get.

boxerab commented 5 years ago

Unfortunately, I get the same error on my bare metal skylake system, with AMD dGPU

boxerab commented 5 years ago
[ERROR], sts=MFX_ERR_UNSUPPORTED(-3), CDecodingPipeline::Init, m_mfxSession.Init failed at src\pipeline_decode.cpp:309

[ERROR], sts=MFX_ERR_UNSUPPORTED(-3), wmain, Pipeline.Init failed at src\sample_decode.cpp:686
boxerab commented 5 years ago

Perhaps the h264 profile is not supported by hardware.

boxerab commented 5 years ago

A sample h264 that is known to work with Skylake decoder would be very useful.

boxerab commented 5 years ago

I ran the mediasdk_analyzer on my system:

Tips:
 - HW target does not work: If you expect it should, then make sure to install
   latest Intel gfx driver, and that Intel gfx is selected as primary driver.
 - If Intel driver is associated with secondary adapter, make sure to
   initialize DirectX device used with Media SDK with corresponding adapter.
ishmael1985 commented 5 years ago

Your issue is described exactly as is. You may need to fiddle with the BIOS to make Intel GPU primary.