# Why is VA-API missing in Smplayer under FreeBSD ?



## john_rambo (Oct 29, 2021)

When I was using Linux I was able to select va-api & va-api copy from that list but these two options are missing under FreeBSD.
What's the reason ?


----------



## zirias@ (Oct 29, 2021)

With that amount of info, I can only guess: no driver installed? (graphics/mesa-gallium-va)


----------



## john_rambo (Oct 29, 2021)

Zirias said:


> With that amount of info, I can only guess: no driver installed? (graphics/mesa-gallium-va)


I have found that package that you mentioned but I don't want to install it without confirmation. Under Linux I was using a system restore tool called Timeshift. I haven't yet figured out how to do that under FreeBSD. So I am worried if installing that package causes breakage which needs a reinstall of FreeBSD it will be a disaster. I have invested a lot of time configuring my install.

*Is this info enough to be really sure ? If not please tell which command is required to get the needed info.*
~

```
> pciconf -lv
hostb0@pci0:0:0:0:    class=0x060000 rev=0x07 hdr=0x00 vendor=0x8086 device=0x190f subvendor=0x1043 subdevice=0x8694
    vendor     = 'Intel Corporation'
    device     = 'Xeon E3-1200 v5/E3-1500 v5/6th Gen Core Processor Host Bridge/DRAM Registers'
    class      = bridge
    subclass   = HOST-PCI
vgapci0@pci0:0:2:0:    class=0x030000 rev=0x06 hdr=0x00 vendor=0x8086 device=0x1912 subvendor=0x1043 subdevice=0x8694
    vendor     = 'Intel Corporation'
    device     = 'HD Graphics 530'
    class      = display
    subclass   = VGA
xhci0@pci0:0:20:0:    class=0x0c0330 rev=0x31 hdr=0x00 vendor=0x8086 device=0xa12f subvendor=0x1043 subdevice=0x8694
    vendor     = 'Intel Corporation'
    device     = '100 Series/C230 Series Chipset Family USB 3.0 xHCI Controller'
    class      = serial bus
    subclass   = USB
none0@pci0:0:22:0:    class=0x078000 rev=0x31 hdr=0x00 vendor=0x8086 device=0xa13a subvendor=0x1043 subdevice=0x8694
    vendor     = 'Intel Corporation'
    device     = '100 Series/C230 Series Chipset Family MEI Controller'
    class      = simple comms
ahci0@pci0:0:23:0:    class=0x010601 rev=0x31 hdr=0x00 vendor=0x8086 device=0xa102 subvendor=0x1043 subdevice=0x8694
    vendor     = 'Intel Corporation'
    device     = 'Q170/Q150/B150/H170/H110/Z170/CM236 Chipset SATA Controller [AHCI Mode]'
    class      = mass storage
    subclass   = SATA
pcib1@pci0:0:28:0:    class=0x060400 rev=0xf1 hdr=0x01 vendor=0x8086 device=0xa114 subvendor=0x1043 subdevice=0x8694
    vendor     = 'Intel Corporation'
    device     = '100 Series/C230 Series Chipset Family PCI Express Root Port'
    class      = bridge
    subclass   = PCI-PCI
pcib2@pci0:0:28:7:    class=0x060400 rev=0xf1 hdr=0x01 vendor=0x8086 device=0xa117 subvendor=0x1043 subdevice=0x8694
    vendor     = 'Intel Corporation'
    device     = '100 Series/C230 Series Chipset Family PCI Express Root Port'
    class      = bridge
    subclass   = PCI-PCI
pcib3@pci0:0:29:0:    class=0x060400 rev=0xf1 hdr=0x01 vendor=0x8086 device=0xa118 subvendor=0x1043 subdevice=0x8694
    vendor     = 'Intel Corporation'
    device     = '100 Series/C230 Series Chipset Family PCI Express Root Port'
    class      = bridge
    subclass   = PCI-PCI
isab0@pci0:0:31:0:    class=0x060100 rev=0x31 hdr=0x00 vendor=0x8086 device=0xa143 subvendor=0x1043 subdevice=0x8694
    vendor     = 'Intel Corporation'
    device     = 'H110 Chipset LPC/eSPI Controller'
    class      = bridge
    subclass   = PCI-ISA
none1@pci0:0:31:2:    class=0x058000 rev=0x31 hdr=0x00 vendor=0x8086 device=0xa121 subvendor=0x1043 subdevice=0x8694
    vendor     = 'Intel Corporation'
    device     = '100 Series/C230 Series Chipset Family Power Management Controller'
    class      = memory
hdac0@pci0:0:31:3:    class=0x040300 rev=0x31 hdr=0x00 vendor=0x8086 device=0xa170 subvendor=0x1043 subdevice=0x86c7
    vendor     = 'Intel Corporation'
    device     = '100 Series/C230 Series Chipset Family HD Audio Controller'
    class      = multimedia
    subclass   = HDA
ichsmb0@pci0:0:31:4:    class=0x0c0500 rev=0x31 hdr=0x00 vendor=0x8086 device=0xa123 subvendor=0x1043 subdevice=0x8694
    vendor     = 'Intel Corporation'
    device     = '100 Series/C230 Series Chipset Family SMBus'
    class      = serial bus
    subclass   = SMBus
re0@pci0:2:0:0:    class=0x020000 rev=0x15 hdr=0x00 vendor=0x10ec device=0x8168 subvendor=0x1043 subdevice=0x8677
    vendor     = 'Realtek Semiconductor Co., Ltd.'
    device     = 'RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller'
    class      = network
    subclass   = ethernet
```

That driver is available as a binary package


```
~> pkg search mesa-gallium-va
mesa-gallium-va-21.1.8         Mesa Gallium VAAPI drivers
```


----------



## eternal_noob (Oct 29, 2021)

john_rambo said:


> I don't want to install it without confirmation.


Just install it. If it doesn't work, remove it. As easy as that.


----------



## john_rambo (Oct 29, 2021)

eternal_noob said:


> Just install it. If it doesn't work, remove it. As easy as that.


Installed *mesa-gallium-va* & did a full reboot but va-api did not appear in the list so uninstalled it.


----------



## zirias@ (Oct 29, 2021)

Maybe you're also missing multimedia/libva-glx (more or less the frontend to the driver). There's no need to reboot when installing/uninstalling packages.


----------



## john_rambo (Oct 29, 2021)

Zirias said:


> Maybe you're also missing multimedia/libva-glx (more or less the frontend to the driver). There's no need to reboot when installing/uninstalling packages.


Installed both by using the command pkg install mesa-gallium-va libva-glx but still no sign of va-api in Smplayer.


----------



## zirias@ (Oct 29, 2021)

From your pciconf output, I see you have an intel GPU. There are several va-api drivers for those in ports, I assume the correct one would be multimedia/libva-intel-media-driver


----------



## john_rambo (Oct 29, 2021)

Zirias said:


> From your pciconf output, I see you have an intel GPU. There are several va-api drivers for those in ports, I assume the correct one would be multimedia/libva-intel-media-driver


Many years ago I had used PC-BSD which as you no was based on FreeBSD. I remember I had this same issue so I had written in their forum. A dev replied saying that Smplayer was not compiled with vdpau support. I was using a Nvidia GPU back then. He asked me to wait for a few days while he compiles Smplayer with vdpau support & he asked me to update my system after a week which will include the Smplayer package which was compiled with vdpau support. After 5-6 days I received an update for Smplayer & I was able to enable vdpau.

So my point is are you sure we have taken the right approach in solving this issue ? I mean maybe the Smplayer package that is in the FreeBSD repos is not compiled with va-api support ?


----------



## eternal_noob (Oct 29, 2021)

john_rambo said:


> I mean maybe the Smplayer package that is in the FreeBSD repos is not compiled with va-api support ?


You can see the compile options on the Freshports page for SMPlayer.

```
===> The following configuration options are available for smplayer-21.1.0_1:
     DEBUG=off: Build with debugging support
     DOCS=on: Build and/or install documentation
     SKINS=on: Install additional skins
     THEMES=on: Install additional themes
====> Multimedia engine: you have to choose at least one of them
     MPLAYER=off: Allow to use MPlayer as multimedia engine
     MPV=on: Allow to use mpv as multimedia engine
===> Use 'make config' to modify these settings
```


----------



## Tieks (Oct 29, 2021)

eternal_noob said:


> MPV=on: Allow to use mpv as multimedia engine


... where multimedia/mpv has optional support for VAAPI.


----------



## zirias@ (Oct 29, 2021)

Tieks said:


> ... where multimedia/mpv has optional support for VAAPI.


... which is enabled by default.

So john_rambo if you didn't fiddle with port options yourself, then yes, identifying which driver you are missing is the correct way to solve this.

In a nutshell, make sure you have libva and libva-glx installed and then install the correct driver for your card. There are several options for intel GPUs, I _think_ the one I mentioned above is the correct one for you, but if it doesn't work, try the others as well.


----------



## john_rambo (Oct 29, 2021)

Zirias said:


> ... which is enabled by default.
> 
> So john_rambo if you didn't fiddle with port options yourself, then yes, identifying which driver you are missing is the correct way to solve this.
> 
> In a nutshell, make sure you have libva and libva-glx installed and then install the correct driver for your card. There are several options for intel GPUs, I _think_ the one I mentioned above is the correct one for you, but if it doesn't work, try the others as well.


Installed *libva-intel-media-driver *& rebooted but didn't work*. *Before I install other drivers I want to know something. Since these are all drivers am I not suppose to reboot after each driver install ? Or at least log out & log back in ?


----------



## zirias@ (Oct 29, 2021)

These are not kernel drivers, just libraries dynamically loaded, so no. But you should restart your video player of course. I also can't guarantee you there's nothing else wrong with either mpv or smplayer right now, so maybe the driver isn't found. If no driver seems to work, I'd first try to use mpv directly from the commandline enabling vaapi to see whether _this_ works.

*edit*: the best way to test is to install multimedia/libva-utils and first check with `vainfo`. Here, it looks like this:

```
$ vainfo
libva info: VA-API version 1.13.0
libva info: Trying to open /usr/local/lib/dri/r600_drv_video.so
libva info: Found init function __vaDriverInit_1_13
libva info: va_openDriver() returns 0
vainfo: VA-API version: 1.13 (libva 2.13.0)
vainfo: Driver version: Mesa Gallium driver 21.1.8 for AMD SUMO (DRM 2.50.0 / 13.0-RELEASE-p4, LLVM 12.0.1)
vainfo: Supported profile and entrypoints
      VAProfileMPEG2Simple            :    VAEntrypointVLD
      VAProfileMPEG2Main              :    VAEntrypointVLD
      VAProfileVC1Simple              :    VAEntrypointVLD
      VAProfileVC1Main                :    VAEntrypointVLD
      VAProfileVC1Advanced            :    VAEntrypointVLD
      VAProfileH264ConstrainedBaseline:    VAEntrypointVLD
      VAProfileH264Main               :    VAEntrypointVLD
      VAProfileH264High               :    VAEntrypointVLD
      VAProfileNone                   :    VAEntrypointVideoProc
```

Only once this finds a working driver, start experimenting with your video player again.


----------



## john_rambo (Oct 29, 2021)

Zirias said:


> the best way to test is to install multimedia/libva-utils and first check with `vainfo`. Here, it looks like this:
> 
> 
> Only once this finds a working driver, start experimenting with your video player again.


This is my output


```
~> vainfo
libva info: VA-API version 1.13.0
libva info: Trying to open /usr/local/lib/dri/iHD_drv_video.so
libva info: Found init function __vaDriverInit_1_13
libva info: va_openDriver() returns 0
vainfo: VA-API version: 1.13 (libva 2.13.0)
vainfo: Driver version: Intel iHD driver for Intel(R) Gen Graphics - 21.3.5 (intel-media-21.3.5)
vainfo: Supported profile and entrypoints
      VAProfileNone                   :    VAEntrypointVideoProc
      VAProfileNone                   :    VAEntrypointStats
      VAProfileMPEG2Simple            :    VAEntrypointVLD
      VAProfileMPEG2Simple            :    VAEntrypointEncSlice
      VAProfileMPEG2Main              :    VAEntrypointVLD
      VAProfileMPEG2Main              :    VAEntrypointEncSlice
      VAProfileH264Main               :    VAEntrypointVLD
      VAProfileH264Main               :    VAEntrypointEncSlice
      VAProfileH264Main               :    VAEntrypointFEI
      VAProfileH264Main               :    VAEntrypointEncSliceLP
      VAProfileH264High               :    VAEntrypointVLD
      VAProfileH264High               :    VAEntrypointEncSlice
      VAProfileH264High               :    VAEntrypointFEI
      VAProfileH264High               :    VAEntrypointEncSliceLP
      VAProfileVC1Simple              :    VAEntrypointVLD
      VAProfileVC1Main                :    VAEntrypointVLD
      VAProfileVC1Advanced            :    VAEntrypointVLD
      VAProfileJPEGBaseline           :    VAEntrypointVLD
      VAProfileJPEGBaseline           :    VAEntrypointEncPicture
      VAProfileH264ConstrainedBaseline:    VAEntrypointVLD
      VAProfileH264ConstrainedBaseline:    VAEntrypointEncSlice
      VAProfileH264ConstrainedBaseline:    VAEntrypointFEI
      VAProfileH264ConstrainedBaseline:    VAEntrypointEncSliceLP
      VAProfileVP8Version0_3          :    VAEntrypointVLD
      VAProfileHEVCMain               :    VAEntrypointVLD
      VAProfileHEVCMain               :    VAEntrypointEncSlice
      VAProfileHEVCMain               :    VAEntrypointFEI
```


----------



## zirias@ (Oct 29, 2021)

That's great, so it is the correct driver after all. Then, the next step would be: try to play a video using va-api with `mpv` (without using the GUI frontend).


----------



## john_rambo (Oct 29, 2021)

Zirias said:


> That's great, so it is the correct driver after all. Then, the next step would be: try to play a video using va-api with `mpv` (without using the GUI frontend).




```
~> mpv --vo=vaapi video.mkv
 (+) Video --vid=1 (*) (h264 640x480 25.000fps)
 (+) Audio --aid=1 --alang=eng (*) (opus 2ch 48000Hz)
[vo/vaapi] OSD format not supported. Disabling OSD.
[vo/vaapi] Warning: this compatibility VO is low quality and may have issues with OSD, scaling, screenshots and more.
[vo/vaapi] vo=gpu is the preferred choice in any case and includes VA-API support via hwdec=vaapi or vaapi-copy.
AO: [oss] 48000Hz stereo 2ch s32
VO: [vaapi] 640x480 yuv420p
AV: 00:00:46 / 00:04:17 (18%) A-V:  0.000

Exiting... (Quit)
```


----------



## zirias@ (Oct 29, 2021)

john_rambo said:


> `[vo/vaapi] vo=gpu is the preferred choice in any case and includes VA-API support via hwdec=vaapi or vaapi-copy.`


So, use this?

But, did your video play correctly with vaapi?


----------



## john_rambo (Oct 29, 2021)

Zirias said:


> So, use this?
> 
> But, did your video play correctly with vaapi?


Yes, it played properly with the --vo=vaapi option. All videos including Full HD & even 4K videos are playing properly even without vaapi but I am worried that this may put excess load on the CPU which may shorten its lifespan.


```
~> mpv --vo=gpu video.mkv
 (+) Video --vid=1 (*) (h264 640x480 25.000fps)
 (+) Audio --aid=1 --alang=eng (*) (opus 2ch 48000Hz)
AO: [oss] 48000Hz stereo 2ch s32
VO: [gpu] 640x480 yuv420p
AV: 00:00:10 / 00:04:17 (4%) A-V: -0.000

Exiting... (Quit)
```

This is the output  using --vo=gpu. As usual the video playback was flawless. 
Now the question is how do I configure the Smplayer frontend to use VA-API ? Using mpv directly without Smplayer is quite troublesome.


----------



## zirias@ (Oct 29, 2021)

I assume mpv offers a config file? Then maybe just configure `vo=gpu` and `hwdec=vaapi` there and use the "Auto" option in the frontend?


----------



## john_rambo (Oct 29, 2021)

Zirias said:


> I assume mpv offers a config file? Then maybe just configure `vo=gpu` and `hwdec=vaapi` there and use the "Auto" option in the frontend?


There is a folder named mpv inside the hidden .config which is in the home folder but that mpv folder is empty.
I just selected the auto option in the Smplayer's settings & played that video. Then I checked the mpv logs by going to View>>mpv logs. The log is a bit long. This is the important part


```
(+) Video --vid=1 (*) (h264 640x480 25.000fps)
 (+) Audio --aid=1 --alang=eng (*) (opus 2ch 48000Hz)
[ffmpeg] AVHWDeviceContext: Failed to query surface attributes: 20 (the requested function is not implemented).
[vo/gpu/vaapi-egl] failed to retrieve libavutil frame constraints
Using hardware decoding (vaapi).
AO: [oss] 48000Hz stereo 2ch s32
VO: [gpu] 640x480 vaapi[nv12]
```

So I guess the auto option actually works as it selected va-api. I really don't understand what's point in removing the
*va-api* & *vdpau* options which are self explanatory & easy to spot. People who know that VA-API is for Intel & VDPAU is for Nvidia will select them as per hardware & non tech users will choose AUTO. We did all this for a problem which doesn't exist.


----------



## zirias@ (Oct 29, 2021)

I think this problem _might_ have existed, as without the correct vaapi driver installed, it wouldn't have worked. But then, I guess using it when it is there isn't the worst default for something labeled "Auto"


----------



## astyle (Oct 29, 2021)

If you run `pkg info multimedia/smplayer`, it will tell you whether your installation has VA-API support compiled into SMPlayer. Just installing the VA-API from packages is not going to help if SMPlayer is compiled without support for it.

This is why I go for ports, rather than packages - I can make sure that VA-API support is actually available and compiled for SMPlayer.


----------



## zirias@ (Oct 29, 2021)

astyle said:


> If you run `pkg info multimedia/smplayer`, it will tell you whether your installation has VA-API support compiled into SMPlayer.


smplayer is just a GUI frontend for either mpv or mplayer, so it doesn't have any VA-API support itself. It defaults to mpv, and mpv has VA-API support enabled by default.


----------



## john_rambo (Oct 29, 2021)

astyle said:


> If you run `pkg info multimedia/smplayer`, it will tell you whether your installation has VA-API support compiled into SMPlayer. Just installing the VA-API from packages is not going to help if SMPlayer is compiled without support for it.
> 
> This is why I go for ports, rather than packages - I can make sure that VA-API support is actually available and compiled for SMPlayer.


Many years ago I tried using PC-BSD which honestly I didn't like so I went back to Linux. Under PC-BSD I tried to install mplayer from ports. Back then I was using my old desktop which went bad some years later. The experience of compiling was just terrible for me. It took hours to compile mplayer. Since then I never tried to compile anything which is why I never even bothered to install Gentoo despite being a distrohopper. One more thing which I am not sure about the ports system. I check for updates everyday & install them as soon as they are offered. If I install an app from the ports how do I update it ? Also is the update process means another waiting for hours ?  


Zirias said:


> smplayer is just a GUI frontend for either mpv or mplayer, so it doesn't have any VA-API support itself. It defaults to mpv, and mpv has VA-API support enabled by default.


Yes, I used the pkg info command but couldn't find the mention of the for VA-API anywhere but since I already know that its working it wasn't a cause for worry.


----------



## astyle (Oct 29, 2021)

john_rambo said:


> If I install an app from the ports how do I update it ? Also is the update process means another waiting for hours ?


yeah, you have a point there...  On my rig, I have KDE from ports (ALL options enabled during compilation), and I'm trying to set up Poudriere to upgrade KDE properly. Still working on a project I started back in August, it's a bowl of Jell-O, and there's a truckload of details to line up. I don't want to check for updates every day. For me (I have a Ryzen 5 1400 3.4 GHz) it takes 24 hours of compiling (Well, I do spread it over 2-3 days to account for source tarball downloads). I guess you gotta have the drive and patience to go with ports, as well as knowledge of how to deal with compilation failures.


----------



## zirias@ (Oct 29, 2021)

I have some custom port options, so I build everything myself. But I also have a server doing that, building a package repository with ports-mgmt/poudriere, so all other machines just install the binary packages. If you don't have the hardware for doing so, using the official package repos isn't the worst idea. The default options in ports are mostly sane and cover most usecases.


----------



## john_rambo (Oct 29, 2021)

Zirias said:


> If you don't have the hardware for doing so, using the official package repos isn't the worst idea. The default options in ports are mostly sane and cover most usecases.


This is my CPU


```
~> sysctl hw.model
hw.model: Intel(R) Core(TM) i3-6100 CPU @ 3.70GHz
```

This the amount of Ram I have installed. I know its very low but I don't face any issues at all. Usually I run Firefox, Thunderbird & Smplayer.


```
~> sysctl hw.realmem
hw.realmem: 4294967296
```

I have one SSD where FreeBSD is installed & a spinning HDD which I use to store only data.

My plan is to install something from the ports just as as an experiment to see long it takes. I boot my desktop in the morning and I shut it down before going to bed. So if it takes more time than that I will have to terminate the process.


----------



## astyle (Oct 29, 2021)

john_rambo said:


> This is my CPU
> 
> 
> ```
> ...


Start with editors/nano. This shouldn't take more than 20 minutes to  1/2 an hour on an i3, even with deps pulled in and compiled. KDE will take forever.


----------



## john_rambo (Oct 29, 2021)

astyle said:


> Start with editors/nano. This shouldn't take more than 20 minutes to  1/2 an hour on an i3, even with deps pulled in and compiled. KDE will take forever.


Okay. Since I was using Linux before I was familiar with nano so I have it installed already but that's no big deal I will just use *pkg delete* & install it from ports.


----------

