LibVLC and avcodec-hw

This forum is about all development around libVLC.
dharks
New Cone
New Cone
Posts: 1
Joined: 16 Jul 2014 13:58

LibVLC and avcodec-hw

Postby dharks » 16 Jul 2014 14:07

I'm working on a video player app to play H.264 video, using LibVLC 2.1.4 on Linux. The hardware this app will run on is an AMD APU without enough horsepower to do the decoding in CPU -- however, libva-based decode works like a champ.

According to the wiki entry on VLC_GPU_Decoding, "By default, hardware acceleration is disabled (and consequently, hardware acceleration is not yet available to external application via LibVLC)."

Is this still the case? Is there any way to turn on libva decode in a LibVLC app? Passing "--avcodec-hw=any" or "--avcodec-hw=vaapi" to the libvlc instance does not seem to convince the system to turn it on.

Thanks much!

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

Re: LibVLC and avcodec-hw

Postby Rémi Denis-Courmont » 16 Jul 2014 19:35

LibVLC 2.2.0+ will enable VDPAU automatically where available. VA support is not complete enough to be enabled in LibVLC.
Rémi Denis-Courmont
https://www.remlab.net/
Private messages soliciting support will be systematically discarded

mgcrea
New Cone
New Cone
Posts: 4
Joined: 22 Nov 2014 01:34

Re: LibVLC and avcodec-hw

Postby mgcrea » 25 Nov 2014 13:25

I've just updated VLC and I am encountering this as well (on a modern NUC BayTrail based machine running Ubuntu 14.04).

In the V2.1 branch, libvlc did defaulted to VAAPI for hardware decoding, and everything was working great.
But since v2.2, it tries to use VDPAU and fails. I'm using latest oibaf intel drivers. I get :

Code: Select all

"Failed to open VDPAU backend libvdpau_i965.so: cannot open shared object file: No such file or directory"
I've seen that the workaround suggested is to use:

Code: Select all

VDPAU_DRIVER=va_gl cvlc media.mp4
But it fails on the first frame:

Code: Select all

[00007f2674c30b78] avcodec decoder: Using OpenGL/VAAPI/libswscale backend for VDPAU for hardware decoding. WARNING: Unsupported the FMO/ASO constraints!!! [00007f2648001268] vdpau_display vout display error: video mixer surface width capabilities query failure: VDP_STATUS_NO_IMPLEMENTATION
However it works flawlessly with :

Code: Select all

cvlc media.mp4 --avcodec-hw=vaapi
I get (same as with v2.1):

Code: Select all

[00007f1f3cc30b78] avcodec decoder: Using Intel i965 driver for Intel(R) Bay Trail - 1.4.1 for hardware decoding. libva info: VA-API version 0.36.0
My issue is that I'm relying on libVLC and I can't find a way to force libVLC to preserve the v2.1 behavior (it did default to VAAPI!). And reading from you, it looks like this is not possible at all.

Is there anything new on this subject? Since it's a breaking change for me (and probably lot of libVLC implementations that were working fine defaulting to VAAPI), is there a way this might get fixed in the future?

Thanks!

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

Re: LibVLC and avcodec-hw

Postby Rémi Denis-Courmont » 25 Nov 2014 15:29

In the V2.1 branch, libvlc did defaulted to VAAPI for hardware decoding, and everything was working great.
This is not true. In V2.1, libvlc did not use hardware acceleration for decoding at all (SIMD aside) by default.
But since v2.2, it tries to use VDPAU and fails.
That is expected if you have Intel HD Graphics, and the result will be the same as in V2.1, except for the short time spent attempting to load the driver and printing error message.
I've seen that the workaround suggested is to use:

Code: Select all

VDPAU_DRIVER=va_gl cvlc media.mp4
You can do that but that is not recommended unless you are sure that your version of VA-GL is robust enough.
Rémi Denis-Courmont
https://www.remlab.net/
Private messages soliciting support will be systematically discarded

mgcrea
New Cone
New Cone
Posts: 4
Joined: 22 Nov 2014 01:34

Re: LibVLC and avcodec-hw

Postby mgcrea » 25 Nov 2014 16:00

This is not true. In V2.1, libvlc did not use hardware acceleration for decoding at all (SIMD aside) by default.
Very strange. I have dozens of linux players that show the same behavior, VA-API is loaded and working. libvlc is being piloted by https://github.com/tjfontaine/node-vlc (using ffi).

Code: Select all

VLC media player 2.1.6 Rincewind (revision 2.1.4+git20141006+r54582+19+11~ubuntu14.04.1)
Sample NodeJS output:

Code: Select all

2014-11-25T14:58:23.873Z - debug: vlc - VLCPlayer.play /srv/player/data/media/547495f1-1574-483f-ba91-06e35e1706d2/media/Elysium_trailer_1-4K-HDTN.mp4 libva info: VA-API version 0.36.0 libva info: va_getDriverName() returns 0 libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/i965_drv_video.so libva info: Found init function __vaDriverInit_0_36 libva info: va_openDriver() returns 0 [0x7f47c0c6b418] avcodec decoder: Using VA API version 0.36 for hardware decoding. [h264 @ 0x7f47c0c6c020] Cannot parallelize deblocking type 1, decoding such frames in sequential order Fontconfig warning: FcPattern object size does not accept value "0" Fontconfig warning: FcPattern object size does not accept value "0"

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

Re: LibVLC and avcodec-hw

Postby Rémi Denis-Courmont » 25 Nov 2014 16:14

If you have patched libvlc or are using non-default settings, you can do that just as well with V2.2, but you are on your own.
Rémi Denis-Courmont
https://www.remlab.net/
Private messages soliciting support will be systematically discarded

mgcrea
New Cone
New Cone
Posts: 4
Joined: 22 Nov 2014 01:34

Re: LibVLC and avcodec-hw

Postby mgcrea » 25 Nov 2014 16:29

I'm not using any patched libvlc. I just installed with apt-get from https://launchpad.net/~videolan/+archiv ... able-daily

Settings passed to libvlc 2.1.0:

Code: Select all

"--ignore-config", "--no-disable-screensaver", "--intf=dummy", "--album-art=0", "--no-media-library", "--no-osd", "--no-stats", "--no-video-title-show", "--avcodec-hw=any"
So it looks like "avcodec-hw=any" option has a new behavior with libVLC v2.2.
Since "--avcodec-hw=vaapi" is not working on v2.2.0, I can't reuse the same settings with 2.2.0 and it's a breaking change for me or any developer using "avcodec-hw=any".

Thanks.

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

Re: LibVLC and avcodec-hw

Postby Rémi Denis-Courmont » 25 Nov 2014 16:54

Parameters to libvlc_new() are not portable across versions. No news here:
https://www.videolan.org/developers/vlc ... ba6e2f7764
Rémi Denis-Courmont
https://www.remlab.net/
Private messages soliciting support will be systematically discarded

mgcrea
New Cone
New Cone
Posts: 4
Joined: 22 Nov 2014 01:34

Re: LibVLC and avcodec-hw

Postby mgcrea » 25 Nov 2014 19:02

Thanks for your help, lesson learnt ;-).


Return to “Development around libVLC”

Who is online

Users browsing this forum: Jona and 36 guests