Skip to content

Instantly share code, notes, and snippets.

@Jiab77
Last active May 20, 2021 17:03
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Jiab77/6af58dde8a41e680d861c71029efb809 to your computer and use it in GitHub Desktop.
Save Jiab77/6af58dde8a41e680d861c71029efb809 to your computer and use it in GitHub Desktop.
Emby Server with VA-API

Emby Server with VA-API

Just a quick gist to keep track of my research on this topic.

Environment

I'm using Ubuntu Server 18.04.2 as operating system.

Download

Go to the download page and select your version: https://emby.media/linux-server.html

For my research, I've used two versions:

  • AMD64
  • ARMHF

The version ARM64 should work too.

Installation

Follow the instruction on the Emby Server download page.

sudo dpkg -i emby-server-deb_4.2.1.0_amd64.deb

Then navigate to http://server-ip:8096 to finish the installation.

Replace server-ip by your server IP address if you are working remotely or you can use localhost instead.

The HTTPS version can be enabled later.

Hardware Acceleration

Now we are going to install the necessary packages to enable VA-API.

1. Install required packages

sudo apt install vainfo xhost xinit

2. Add required privileges

sudo usermod -a -G video $USER
sudo usermod -a -G video emby

3. Add required config

In order to avoid issues because LibVA is unable to find a physical display, you will have to add some lines into the file /etc/rc.local.

If the file does not already exists, just create it and make it executable.

sudo nano /etc/rc.local
#!/bin/bash

# Start X server on display :0
/usr/bin/xinit -- :0 > /root/xinit.log 2>&1 &

# Wait 4 secs while server is starting
sleep 4

# Disable access control on display :0
echo export DISPLAY=:0 >> /root/xhost.log 2>&1
export DISPLAY=:0 >> /root/xhost.log 2>&1
xhost + >> /root/xhost.log 2>&1

Save the file and make it executable if it does not already:

sudo chmod -v u+x /etc/rc.local

4. Apply changes

The last step is to reboot your device in order to apply the performed changes.

sudo reboot

5. Test the hardware acceleration

To test if everything is installed and running correctly, simply run the command vainfo, you should have a similar output.

error: can't connect to X server!
libva info: VA-API version 1.1.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_1_1
libva info: va_openDriver() returns 0
vainfo: VA-API version: 1.1 (libva 2.1.0)
vainfo: Driver version: Intel i965 driver for Intel(R) CherryView - 2.1.0
vainfo: Supported profile and entrypoints
      VAProfileMPEG2Simple            :	VAEntrypointVLD
      VAProfileMPEG2Simple            :	VAEntrypointEncSlice
      VAProfileMPEG2Main              :	VAEntrypointVLD
      VAProfileMPEG2Main              :	VAEntrypointEncSlice
      VAProfileH264ConstrainedBaseline:	VAEntrypointVLD
      VAProfileH264ConstrainedBaseline:	VAEntrypointEncSlice
      VAProfileH264Main               :	VAEntrypointVLD
      VAProfileH264Main               :	VAEntrypointEncSlice
      VAProfileH264High               :	VAEntrypointVLD
      VAProfileH264High               :	VAEntrypointEncSlice
      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
      VAProfileHEVCMain               :	VAEntrypointVLD

If you got something similar, then Emby Server should detect the new available hardware acceleration.

You can verify if Emby Server detected the change by piping detection result to jq.

jq must be installed first, simply run sudo apt install jq if it does not.

cat /var/lib/emby/logs/hardware_detection-63701177710.txt | jq .DetectionOutputs.Vaapi.Result.Devices[0].DeviceInfo
{
  "VendorName": "Intel Corporation",
  "DeviceName": "Atom/Celeron/Pentium Processor x5-E8000/J3xxx/N3xxx Integrated Graphics Controller",
  "SubsytemVendorName": "Intel Corporation",
  "VendorId": 32902,
  "DeviceId": 8881,
  "SubsytemVendorId": 32902,
  "SubsytemDeviceId": 29296,
  "DevPath": "/sys/bus/pci/devices/0000:00:02.0",
  "DrmCard": "/dev/dri/card0",
  "DrmRender": "/dev/dri/renderD128",
  "IsEnabled": 1,
  "IsBootVga": 1,
  "ApiVersionMajor": 1,
  "ApiVersionMinor": 4,
  "Driver": "Intel i965 driver for Intel(R) CherryView - 2.3.0"
}

Change the detection file according the ones existing in folder /var/lib/emby/logs.

References

These links helped me to make this gist.

Contribute

Feel free to comment if you have any issues or suggestions about this gist 😉

Contact

You can reach me on Twitter using @Jiab77

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment