LibVLC 4 and DX11

This forum is about all development around libVLC.
ChristianH
New Cone
New Cone
Posts: 8
Joined: 13 Mar 2020 20:07

LibVLC 4 and DX11

Postby ChristianH » 02 May 2020 11:14

Hi,

I'm not sure if it is a bug, but I'm unable to get Libvlc 4.0 working under Windows 8 without having DX11. It seem to be that no matter which vout I try to use DX11 will be chosen and fails.

Code: Select all

avcodec decoder debug: using ffmpeg Lavc58.59.102 avcodec decoder debug: CPU flags: 0x000fd3db avcodec decoder debug: allowing 3 thread(s) for decoding avcodec decoder debug: codec (h264) started avcodec decoder debug: using frame thread mode with 3 threads main generic debug: using video decoder module "avcodec" avcodec decoder debug: available hardware decoder output format 119 (cuda) avcodec decoder debug: available hardware decoder output format 53 (dxva2_vld) avcodec decoder debug: available hardware decoder output format 118 (d3d11va_vld) avcodec decoder debug: available hardware decoder output format 174 (d3d11) avcodec decoder debug: available software decoder output format 0 (yuv420p) avcodec decoder debug: trying format d3d11va_vld main decoder debug: vout: none found main decoder debug: vout change: decoder size main decoder debug: vout change: visible size main generic debug: looking for text renderer module matching "any": 3 candidates freetype spu text debug: Using DWrite backend freetype spu text debug: DWrite_GetFamily(): family name: Arial freetype spu text debug: DWrite_ParseFamily(): using font at index 0 with weight 400 for bold: 0, italic: 0 freetype spu text debug: DWrite_ParseFamily(): using font at index 1 with weight 700 for bold: 1, italic: 0 freetype spu text debug: DWrite_ParseFamily(): using font at index 2 with weight 400 for bold: 0, italic: 1 freetype spu text debug: DWrite_ParseFamily(): using font at index 3 with weight 700 for bold: 1, italic: 1 main generic debug: using text renderer module "freetype" main generic debug: looking for video converter module matching "any": 20 candidates swscale scale debug: 32x32 (32x32) chroma: YUVA -> 16x16 (16x16) chroma: RGBA with scaling using Bicubic (good quality) main generic debug: using video converter module "swscale" main generic debug: looking for video converter module matching "any": 20 candidates yuvp scale debug: YUVP to YUVA converter main generic debug: using video converter module "yuvp" main video output debug: Deinterlacing available main video output debug: deinterlace -1, mode auto, is_needed 0 main generic debug: looking for vout window module matching "embed-hwnd,any": 6 candidates main generic debug: using vout window module "drawable" main generic debug: looking for inhibit module matching "any": 1 candidates main generic debug: using inhibit module "inhibit" main generic debug: looking for decoder device module matching "any": 1 candidates nvdec generic error: Cannot load nvcuda.dll main generic debug: no decoder device modules matched avcodec decoder debug: trying format dxva2_vld main generic debug: looking for decoder device module matching "any": 1 candidates nvdec generic error: Cannot load nvcuda.dll main generic debug: no decoder device modules matched main decoder debug: vout change: decoder size main decoder debug: vout change: chroma main video output debug: deinterlace -1, mode auto, is_needed 0 main video output debug: Opening vout display wrapper main generic debug: looking for vout display module matching "any": 12 candidates direct3d11 vout display debug: Created the D3D11 device type 1 level 9300. direct3d11 vout display warning: failed to read the 0 Display Adapter registry key (2) direct3d11 vout display warning: can't find adapter in registry direct3d11 vout display debug: Incompatible feature level 9300 direct3d11 vout display error: Could not Create the D3D11 device.
I use in this case, which works in VLC3 properly:

--vout=direct3d9
--avcodec-hw=dxva2

The other issue is that the video size does not fit the declared window handle and is always equal to the video size. I use an updated build of PaslibVLC since a couple of functions where deprecated.

Maybe somebody has an advise to solve these two issues.

Christian

mfkl
Developer
Developer
Posts: 746
Joined: 13 Jun 2017 10:41

Re: LibVLC 4 and DX11

Postby mfkl » 02 May 2020 22:17

Which build are you using exactly? Can you share full logs from beginning to end?

This sample should work fine https://github.com/videolan/vlc/blob/master/doc/libvlc/d3d9_player.c (uses the callbacks API, but that's unrelated)
https://mfkl.github.io

ChristianH
New Cone
New Cone
Posts: 8
Joined: 13 Mar 2020 20:07

Re: LibVLC 4 and DX11

Postby ChristianH » 03 May 2020 10:00

Hi,

right now I use the nightly build, but I also tried to use builds from last year.

I'm aware of both samples (DX11 and DX9). The problem is that the player should be platform independent and I try to avoid the usage of the DirectX API at all costs. My work around at the moment is that I remove the libdirect3d11_plugin.dll if the running system is < Windows 10.
The biggest problem is right now, that it seem to be that libvlc_media_player_set_hwnd is not tested in VLC4, in both demos it is marked as don't use.
// DON'T use with callbacks libvlc_media_player_set_hwnd(p_mp, hWnd);

Technically I do

libvlc_media_add_option(p_md, "vout=direct3d9");
libvlc_media_add_option(p_md, "avcodec-hw=dxva2");

I'm not sure if these options are correct to force the usage of DX9 at all costs.

and then I set the hwnd of main form. The video is played inside the defined window, but the dimensions of the video are the one of the video and it is not scaled to the window boundary. It works with all older VLC builds.

The complete log looks like this: https://pastebin.com/raw/RFYZC4Hb
With the removed plugin it looks like this: https://pastebin.com/raw/SCch3Njf

Oh and one other issue is: No matter if I use overlay or no-overlay as option vlc stops after loading the plugins. Are these options obsolete if so it should at least not crash libvlc?

Christian

ChristianH
New Cone
New Cone
Posts: 8
Joined: 13 Mar 2020 20:07

Re: LibVLC 4 and DX11

Postby ChristianH » 03 May 2020 10:25

Addentum:
vlc-4.0.0-20191213-0249-dev-win32.zip and older do not crash, vlc-4.0.0-20191220-0248-dev-win32.zip is the first build where it crashes because of the DX1 plugin.
The scaling video issue is in all VLC4 builds back till 2018.

Rémi Denis-Courmont
Developer
Developer
Posts: 15287
Joined: 07 Jun 2004 16:01
VLC version: master
Operating System: Linux
Contact:

Re: LibVLC 4 and DX11

Postby Rémi Denis-Courmont » 03 May 2020 10:33

The vout option cannot be applied to media items since version 1.0.0.
Rémi Denis-Courmont
https://www.remlab.net/
Private messages soliciting support will be systematically discarded

ChristianH
New Cone
New Cone
Posts: 8
Joined: 13 Mar 2020 20:07

Re: LibVLC 4 and DX11

Postby ChristianH » 03 May 2020 10:45

Ah okay, thanks for the answer. I did not tested it with VLC3 and I just thought I might use this in order to work around the crash.
Unluckily the first I thought simpler issue seem to be more complicated:

Image The video ignores the dimension of the window and there seem to be no way to fit it.

LiberiFatali
New Cone
New Cone
Posts: 2
Joined: 29 May 2023 09:17

Re: LibVLC 4 and DX11

Postby LiberiFatali » 17 Jul 2023 06:56


I'm aware of both samples (DX11 and DX9). The problem is that the player should be platform independent and I try to avoid the usage of the DirectX API at all costs. My work around at the moment is that I remove the libdirect3d11_plugin.dll if the running system is < Windows 10.
Thank you! This workaround also works for my case, in which I need to remove libd3d11va.

Hope there will be a easier way to pass --vout parameters.


Return to “Development around libVLC”

Who is online

Users browsing this forum: No registered users and 22 guests