Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 27 Feb 2019 12:31:57 +0100
From:      Jan Beich <jbeich@FreeBSD.org>
To:        <driesm.michiels@gmail.com>
Cc:        <freebsd-multimedia@freebsd.org>
Subject:   Re: FFmpeg hardware transcoding
Message-ID:  <ef7t-a2mq-wny@FreeBSD.org>
References:  <005401d4c957$c6bbc840$543358c0$@gmail.com> <o976-vzk9-wny@FreeBSD.org> <002801d4ce0a$75c29bf0$6147d3d0$@gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
<driesm.michiels@gmail.com> writes:

> Hi Multimedia mailing list,
>
> Here I am again with a follow-up question to this.
> I was wondering if hardware acceleration is possible even if I am building
> all ports with X11 unset (off).

X11=off is generally untested territory. Please, make sure VAAPI works in your
environment (e.g., headless) before fiddling with port options.

> I noticed that when building ports related to hardware acceleration, more
> specifically, libva-utils to check if driver etc is detected with vainfo, it
> fails with this;
>
> [~]$ vainfo
> ld-elf.so.1: Shared object "libva-x11.so.2" not found, required by "vainfo"

After disabling X11 or WAYLAND in libva make sure to rebuild all direct consumers e.g.,
libva-utils, libva-intel-driver, ffmpeg. poudriere should have done that for you.
If you're building manually or via portmaster don't expect handholding.

> This fails because I build libva without X11 support. Is vainfo only
> supported to work on platforms that are running an X11 server?

Dependency on X11 libraries doesn't imply dependency on a running X11 server.
I don't maintain libva-utils, so no clue if X11 can be disabled at compile time.

> When I reinstall libva with X11 support vainfo works, although it does say
> its not detecting X11 server (which I'm not interested in).
> I am interested however in the capabilities of the detected driver and if it
> is detected at all.
>
> Output of vainfo:
> [~]$ vainfo
> error: XDG_RUNTIME_DIR not set in the environment.

XDG_RUNTIME_DIR is only required when running in Wayland compositor.
It's a result of WAYLAND option enabled by default and is safe to ignore.

> error: can't connect to X server!
> vainfo: VA-API version: 1.4 (libva 2.4.0)
> vainfo: Driver version: Intel i965 driver for Intel(R) Skylake - 2.3.0

I'm on Skylake as well, so what works for me is very likely to work for you. ;)

> vainfo: Supported profile and entrypoints
>       VAProfileMPEG2Simple            : VAEntrypointVLD
>       VAProfileMPEG2Simple            : VAEntrypointEncSlice
>       VAProfileMPEG2Main              : VAEntrypointVLD
>       VAProfileMPEG2Main              : VAEntrypointEncSlice
>       VAProfileH264ConstrainedBaseline: VAEntrypointVLD
>       VAProfileH264ConstrainedBaseline: VAEntrypointEncSlice
>       VAProfileH264ConstrainedBaseline: VAEntrypointEncSliceLP
>       VAProfileH264ConstrainedBaseline: VAEntrypointFEI
>       VAProfileH264ConstrainedBaseline: VAEntrypointStats
>       VAProfileH264Main               : VAEntrypointVLD
>       VAProfileH264Main               : VAEntrypointEncSlice
>       VAProfileH264Main               : VAEntrypointEncSliceLP
>       VAProfileH264Main               : VAEntrypointFEI
>       VAProfileH264Main               : VAEntrypointStats
>       VAProfileH264High               : VAEntrypointVLD
>       VAProfileH264High               : VAEntrypointEncSlice
>       VAProfileH264High               : VAEntrypointEncSliceLP
>       VAProfileH264High               : VAEntrypointFEI
>       VAProfileH264High               : VAEntrypointStats
>       VAProfileH264MultiviewHigh      : VAEntrypointVLD
>       VAProfileH264MultiviewHigh      : VAEntrypointEncSlice
>       VAProfileH264StereoHigh         : VAEntrypointVLD
>       VAProfileH264StereoHigh         : VAEntrypointEncSlice
>       VAProfileVC1Simple              : VAEntrypointVLD
>       VAProfileVC1Main                : VAEntrypointVLD
>       VAProfileVC1Advanced            : VAEntrypointVLD
>       VAProfileNone                   : VAEntrypointVideoProc
>       VAProfileJPEGBaseline           : VAEntrypointVLD
>       VAProfileJPEGBaseline           : VAEntrypointEncPicture
>       VAProfileVP8Version0_3          : VAEntrypointVLD
>       VAProfileVP8Version0_3          : VAEntrypointEncSlice

libva-intel-driver can be built with partial VP9 (8bit) decoding support.
Maybe useful for transcoding 4K videos obtained from YouTube.

>       VAProfileHEVCMain               : VAEntrypointVLD
>       VAProfileHEVCMain               : VAEntrypointEncSlice

Compared to H264 encoder HEVC requires more GPU power. Check GPU usage
via intel_gpu_top (not in ports) if you need to achieve certain speed.

https://github.com/markjdb/intel-gpu-tools

>
> Possible solution (although I'm really just guessing here and are probably
> not correct in many ways);
> - Try build vainfo without linking against libva-x11.so
> - Remove X11 option from libva and always enable it (only a few extra
> libraries that get pulled in by this)

Another option:
- Don't install libva-utils



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?ef7t-a2mq-wny>