Knowledge Base
Searching in : Article
ID: AR09O00938
Applies to: NoMachine Software
Added on: 2017-09-21
Last Update: 2022-02-28
Print this article

How to use Intel H.264 HW encoder with NoMachine

On Windows and Linux platforms, NoMachine is able to use Intel® Quick Sync technology on those machines which are equipped with a suitable hardware. (Support on Windows and Linux for GPU-accelerated H.264 encoding provided by QuickSync APIs is out of beta status since NoMachine v. 5.3.12).
 
Windows
Windows (from Vista onward) comes with drivers for Quick Sync video support included. Hardware accelerated encoding works out-of-the-box in NoMachine sessions provided the processor supports it.  Intel® HD Graphics 4200” and “Intel® HD Graphics P4600” or higher, support Quick Sync Video. There is no additional configuration necessary.

Linux
On Linux instead, to enable HW acceleration by Quick Sync it's necessary to install Intel® Media SDK (MSDK), http://mediasdk.intel.com/.

Your hardware must be compatible with MSDK, e.g.
- 5th and 6th Generation Intel Core or newer
- Xeon E3-1200 v4 Family (C226 chipset), E3-1200 v5 and E3-1500 v5 Family (C236).

Please find here the supported architectures: https://github.com/intel/media-driver#supported-platforms
 

First method,  install Media SDK from Intel
1. If the  /opt/intel/mediasdk directory exists, delete it:
rm -rf /opt/intel/mediasdk

2. Retrieve the Media SDK (a more recent version could be available, tests have been done with the following version):
wget https://github.com/Intel-Media-SDK/MediaSDK/releases/download/intel-mediasdk-21.2.3/MediaStack.tar.gz 

3. Uncompress and install Media SDK:
tar xvzf MediaStack.tar.gz 
cd MediaStack
./install_media.sh

 

Second method, install Media SDK from Ubuntu repositories

Some Linux Operating Systems have built-in support for Quick Sync and the neccessary packages already available on their standard repository.

E.g. on Ubuntu 20.04 it's enough to install the following:
sudo apt install intel-media-va-driver libmfx1 libva2 libva-drm2

On Fedora 39 required packages are:
- libva (includes libva-drm)
- intel-mediasdk (includes libmfxhw64)
- intel-media-driver (includes iHD) - this package requires RPM Fusion non-free repository, which can be installed by (on a single line):

sudo dnf install https://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm

After adding this repository, it should be possible to install all needed components:

sudo dnf install libva intel-mediasdk intel-media-driver

 

If  the architecture is fully supported, it should work out-of-the-box. If not, please check if sample encoder from Intel Media SDK works for you: https://github.com/Intel-Media-SDK/MediaSDK

TIP
To verify that NoMachine is using QuickSync, create a new NoMachine virtual desktop or connect to the remote physical desktop. Then on the server host look for the 'session' file for in the user's home/.nx/node/C-* directory.
With NoMachine v. 6, look for the session file in the /usr/NX/var/log/node/C-*/ directory instead.
 


On other Linux systems which don't have MSDK built-in support or don't have the necessary packages on their repository, you might want to build it by yourself. In such case please check minimum system requirements here and follow instructions provided by Intel®: https://github.com/Intel-Media-SDK/MediaSDK#system-requirements


For older Linux versions, once Intel® Media SDK (MSDK) is installed, it's necessary to recompile the kernel (except on CentOS 7.3/RHEL 7.3 ). 

How to install Intel® Media SDK on Linux

The following instructions use the Intel® Media Server Studio suite v. 2017 R3.
Execute the following commands as root or sudo user, when necessary.

1. Add users who will use QuickSync to the 'video' group:

usermod -a -G video [LOGIN]

for example:

sudo usermod -a -G video nxtest01

2. Check if Intel VGA adapter is listed:

lspci -nn -s 0:02.0

3. Download Intel Media Server Studio (https://software.intel.com/en-us/intel-media-server-studio) for Linux and extract the archive:

tar -xzf MediaServerStudio*.tar.gz
cd MediaServerStudio*
tar -xzf SDK2017*.tar.gz

4. Ensure to have glibc >= 2.12 and gcc >= 4.7:

gcc --version
ldd --version
 

5. Install Intel Media Server Studio

On Centos/RHEL 7.3

These instructions apply only to CentOS 7.3.1611 (kernel 3.10.0-514.el7.x86_64).

Extract and run the SDK installation script as root:

cd SDK2017*/CentOS
tar -xzf install_scripts_*.tar.gz
./install_sdk_CentOS.sh

Reboot the system.

On other Linux platforms

5.1. Remove libdrm and libva modules:

find /usr -name "libdrm*" | xargs rm -rf
find /usr -name "libva*" | xargs rm -rf

5.2. Remove old MSDK files:

rm -rf /opt/intel/mediasdk
rm -rf /opt/intel/common
rm -rf /opt/intel/opencl

5.3. Unpack user mode components:

cd SDK2017*/Generic
tar -xvzf intel-linux-media_generic*.tar.gz
tar -xvJf intel-opencl-cpu-*.tar.xz
tar -xvJf intel-opencl-devel-*.tar.xz
tar -xvJf intel-opencl-r*.tar.xz

5.4. Copy components to standard locations:

cp -r etc/* /etc
cp -r lib/* /lib
cp -r opt/* /opt
cp -r usr/* /usr

5.5. Ensure that the new libraries can be found:

echo '/usr/lib64' > /etc/ld.so.conf.d/libdrm_intel.conf
echo '/usr/local/lib' >> /etc/ld.so.conf.d/libdrm_intel.conf
ldconfig

5.6. Install kernel build dependencies:

apt-get -y install git fakeroot build-essential ncurses-dev xz-utils libssl-dev bc g++

5.7. Download and unpack kernel:

wget https://www.kernel.org/pub/linux/kernel/v4.x/linux-4.4.tar.xz
tar -xJf linux-4.4.tar.xz

5.8. Apply kernel patches:

cp /opt/intel/mediasdk/opensource/patches/kmd/4.4/intel-kernel-patches.tar.bz2 .
tar -xvjf intel-kernel-patches.tar.bz2
cd linux-4.4
for i in ../intel-kernel-patches/*.patch; do patch -p1 < $i; done

5.9. Build kernel:

make olddefconfig
make -j 8
make modules_install
make install

5.10. Update LD_LIBRARY_PATH to include "/usr/lib64:/usr/local/lib" in /etc/environment.

5.11. Reboot the system.

 

6. Verify that NoMachine is using QuickSync:

Create a new NoMachine virtual desktop or connect to the remote physical desktop. Then, for v. 7 or later on the server host look for the 'session' file for in the user's home/.nx/node/C-*/ directory. For NoMachine v. 6, look for the 'session' file in /usr/NX/var/log/node/C-*/ directory instead.

If everything is working correctly you will see the following string in the session file:
Info: Using Intel H.264 hardware encoder.

 

 

For further details to configure Intel Quick Sync Video, please refer to the official documentation:
https://software.intel.com/sites/default/files/managed/52/a7/media_server_studio_getting_started_guide.pdf
https://software.intel.com/en-us/articles/how-to-setup-media-server-studio-on-secondary-os-of-linux