Intel QSV(ffmepg codec) support in Linux

EDIT: Here I am referring to QSV which is a codec supported by ffmpeg, you can see more information here: https://trac.ffmpeg.org/wiki/Hardware/QuickSync

I’m currently using ArchLinux. In the case of correctly configuring the graphics card driver, the graphics card of Intel 11th and 12th CPU can already use the QSV encoding function normally.
Emby, Jellyfin both support this feature, so why not consider supporting it? :smiley:
As this article says: FFmpeg and oneVPL-intel-gpu (or quicksync) / Newbie Corner / Arch Linux Forums
In the latest version of FFmepg, it can support QSV encoding by turning on the flag; at the same time, we also know that Linux 6.1 does not yet support the QSV encoder of Intel graphics cards such as A380-this may require us to wait for a while.

P.S I also tested it under Fedora, it doesn’t even need to manually install the driver, it works out of the box - QSV decoder.‘

ffmepg version info:

ffmpeg version 5.1.2 Copyright (c) 2000-2022 the FFmpeg developers
built with gcc 12.2.1 (GCC) 20230111
configuration: --prefix=/usr --extra-cflags=-I/opt/cuda/include --extra-ldflags=-L/opt/cuda/lib64 --enable-lto --disable-rpath --enable-gpl --enable-version3 --enable-nonfree --enable-shared --disable-static --disable-stripping --enable-gray --enable-alsa --enable-avisynth --enable-bzlib --enable-chromaprint --enable-frei0r --enable-gcrypt --enable-gmp --enable-gnutls --enable-iconv --enable-ladspa --enable-lcms2 --enable-libaom --enable-libaribb24 --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcelt --enable-libcdio --enable-libcodec2 --enable-libdav1d --enable-libdavs2 --enable-libdc1394 --enable-libfdk-aac --disable-libflite --enable-fontconfig --enable-libfreetype --enable-libfribidi --enable-libglslang --enable-libgme --enable-libgsm --enable-libiec61883 --enable-libilbc --enable-libjack --enable-libjxl --enable-libklvanc --enable-libkvazaar --enable-liblensfun --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --disable-libopencv --enable-libopenh264 --enable-libopenjpeg --enable-libopenmpt --disable-libopenvino --enable-libopus --enable-libplacebo --enable-libpulse --enable-librabbitmq --enable-librav1e --enable-librist --enable-librsvg --enable-librubberband --enable-librtmp --enable-libshine --enable-libsmbclient --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libsvtav1 --enable-libsvthevc --enable-libsvtvp9 --disable-libtensorflow --enable-libtesseract --enable-libtheora --disable-libtls --enable-libtwolame --enable-libuavs3d --enable-libv4l2 --enable-libvidstab --enable-libvmaf --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxavs2 --enable-libxcb --enable-libxcb-shm --enable-libxcb-xfixes --enable-libxcb-shape --enable-libxvid --enable-libxml2 --enable-libzimg --enable-libzmq --enable-libzvbi --enable-lv2 --enable-lzma --enable-decklink --disable-mbedtls --enable-libmysofa --enable-openal --enable-opencl --enable-opengl --disable-openssl --enable-pocketsphinx --enable-sndio --enable-sdl2 --enable-vapoursynth --enable-vulkan --enable-xlib --enable-zlib --enable-amf --enable-cuda-nvcc --enable-cuda-llvm --enable-cuvid --enable-ffnvcodec --enable-libdrm --enable-libmfx --enable-libnpp --enable-nvdec --enable-nvenc --enable-omx --enable-rkmpp --enable-v4l2-m2m --enable-vaapi --enable-vdpau
libavutil      57. 28.100 / 57. 28.100
libavcodec     59. 37.100 / 59. 37.100
libavformat    59. 27.100 / 59. 27.100
libavdevice    59.  7.100 / 59.  7.100
libavfilter     8. 44.100 /  8. 44.100
libswscale      6.  7.100 /  6.  7.100
libswresample   4.  7.100 /  4.  7.100
libpostproc    56.  6.100 / 56.  6.100

It can decode video via QSV:

ffmpeg -hwaccel qsv -c:v h264_qsv -i input.mp4 -vf hwdownload,format=nv12 -pix_fmt yuv420p output.yuv

图片
图片

图片

Plex is using Intel QSV just fine on my Linux setup (Ubuntu 22.04). Last I checked, ArchLinux however wasn’t officially supported by PMS… so my guess is that this is where your problem might be.

https://support.plex.tv/articles/115002178853-using-hardware-accelerated-streaming/

1 Like

Yes, the official Plex documentation for Linux does not mention QSV decoding.

I have tested it in Fedora:

I don’t see a live media information (bitrate, transcoded or not) feature like YouTube, Jellyfin in Plex. If you do, please let me know, I would appreciate it. So, I used Jellyfin’s VA-API and QSV separate decoding comparison to determine which API Plex uses. test video is the same video.

We can see that the 3D term in Intel GPU Top is close to zero percent, while the load on the decoder is between 30 and 40 percent.

In this test. We can clearly observe the difference from the previous test: the 3D load has obvious fluctuation, about 13 to 14 percent occupation; the codec load is stable at about 38 percent.

  • enable hard acceleration in Plex


In this test, we can see that the decoder item usage and 3D usage are both very high, and this cleanup is similar to Jellyfin with VA-API enabled, so I assume that Plex is using VA-API.

In summary, I see in the official download drivers that Fedora is an officially supported OS. Therefore, this test should mean that Plex does not support the Intel QSV decoding feature in my current environment.
If the official implementation of QSV decoding features in Linux (which is just not listed in the documentation due to oversight), then I think the problem is likely to be the replacement of the GPU driver implementation of Intel 11 and 12 generation CPUs (can be understood, right?) The problem is probably caused by the replacement of the GPU driver implementation (can that be understood?) for Intel 11 and 12 generation CPUs.

As mentioned in the ArchLinux community address in the body of my post, Intel
The new generation GPUs require the onevpl-intel-gpu driver to activate Guv and Huv – in order for QSV to work. FFmpeg has only been supported in the Master branch for a short while now, and requires a special flag to be enabled to support the QSV decoding features of the new generation CPUs.

Therefore, if Plex supports QSV decoding, you can consider referring to the ffmpeg parameters compiled by Jellyfin to realize the QSV decoding features of the new generation CPU.

Edit:
The Official document DO NOT list QSV decoder in Linux.

QSV is supported just fine, it is Arch that is not - you’re asking for the wrong thing.

Okay, thanks for your answer. Maybe it is the issue of intel 11gen and later in Linux—— So I changed the title.
You can see the post behind you. I test this feature in Fedora, which is a supported OS in official list.

here you can see 11th gen working on ubuntu over 1 year ago → When "Enable HDR tone mapping" is enabled, hw trancoding fails on 11th gen Intel (Iris Xe graphics) due to supplied Intel drivers

there are more examples if you search.

Ah, I guess you misunderstood me, Plex’s hard decode acceleration works fine for me (Fedora and ArchLinux), but it uses the VA-API interface for codec support, which by default costs more performance than the QSV interface - which can be interpreted as Performance is worse than QSV interface.



The illustration may be a strong evidence that Plex is using vaapi as a codec interface on my Fedora

I’ve searched the community, but they don’t have much discussion on QSV decoding - they only care about hardware decoding working properly.
Like: Ubuntu Intel N5105 QSV HW Transcoder not detected


According to the log, Plex didn’t try the QSV decoder in the workflow, it only tried the VA-API decoder - which is in line with the priority order mentioned in the Plex documentation. That’s why I thought this was a feature request at first.

QSV is an Intel marketing term for a hardware feature in their CPUs

VA-API is a way to access hardware QSV. Intel media SDK is another way to access it (Jellyfin, Empy and some other software refer to this as the QSV pipeline)

So, PMS does support QSV hardware decode and encode by VA-API. If you search for Intel Media SDK you’ll find more info on what you are referring to as QSV.

Here you can see where Jellyfin refer to their QSV pipeline as a forked and modified version of VA-API.

Don’t understand you.

VA-API can use Quick Sync.

Yes, you’re right. QSV usually refers to Intel CPU’s marketing technology.

What I’m here is actually the technique supported by ffmepg as expressed.

Like AMF, QSV, which is defiend in ffmpeg, have a better performance than original VA-API(the benchmark, I tested, you can see 2#), little to no 3D usage, and slightly improved video codec usage.

We can directly use this codec via ffmpeg:

ffmpeg -hwaccel qsv -hwaccel_output_format qsv -c:v h264_qsv -i sample.mp4 -vf hwdownload,format=nv12 -pix_fmt yuv420p output.yuv

According to some articles in the community, I speculate that Plex uses ffmepg. In this case, it is relatively easy to add a few decoders to support it, right? For more decoding attitudes, we should be more welcome, after all, the workload is not too big.

QSV and VA-API are two different interfaces in FFmpeg to access Intel’s QuickSync hardware.

Usually QSV has more fine tuning options to tradeoff between speed and quality and it is build on top of VA-API on Linux.

So in theory Plex does support QuickSync, but through the VA-API interface.

And @a632079 it seems you are not using Jellyfin’s optimized ffmpeg instead of the stock one from fedora repo. Swap to this portable build can improve the performance.

1 Like

Yes, you know exactly what I mean! Thanks a lot for adding my perspective!

My ffmepg compiled version is ffmpeg-full by AUR, which is built with much more building flags.

Forgive me I am more used to using ArchLinux as my test environment. :smiley:

Here is my ffmpeg versioin information:

❯ ffmpeg -version
ffmpeg version 5.1.2 Copyright (c) 2000-2022 the FFmpeg developers
built with gcc 12.2.1 (GCC) 20230111
configuration: --prefix=/usr --extra-cflags=-I/opt/cuda/include --extra-ldflags=-L/opt/cuda/lib64 --enable-lto --disable-rpath --enable-gpl --enable-version3 --enable-nonfree --enable-shared --disable-static --disable-stripping --enable-gray --enable-alsa --enable-avisynth --enable-bzlib --enable-chromaprint --enable-frei0r --enable-gcrypt --enable-gmp --enable-gnutls --enable-iconv --enable-ladspa --enable-lcms2 --enable-libaom --enable-libaribb24 --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcelt --enable-libcdio --enable-libcodec2 --enable-libdav1d --enable-libdavs2 --enable-libdc1394 --enable-libfdk-aac --disable-libflite --enable-fontconfig --enable-libfreetype --enable-libfribidi --enable-libglslang --enable-libgme --enable-libgsm --enable-libiec61883 --enable-libilbc --enable-libjack --enable-libjxl --enable-libklvanc --enable-libkvazaar --enable-liblensfun --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --disable-libopencv --enable-libopenh264 --enable-libopenjpeg --enable-libopenmpt --disable-libopenvino --enable-libopus --enable-libplacebo --enable-libpulse --enable-librabbitmq --enable-librav1e --enable-librist --enable-librsvg --enable-librubberband --enable-librtmp --enable-libshine --enable-libsmbclient --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libsvtav1 --enable-libsvthevc --enable-libsvtvp9 --disable-libtensorflow --enable-libtesseract --enable-libtheora --disable-libtls --enable-libtwolame --enable-libuavs3d --enable-libv4l2 --enable-libvidstab --enable-libvmaf --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxavs2 --enable-libxcb --enable-libxcb-shm --enable-libxcb-xfixes --enable-libxcb-shape --enable-libxvid --enable-libxml2 --enable-libzimg --enable-libzmq --enable-libzvbi --enable-lv2 --enable-lzma --enable-decklink --disable-mbedtls --enable-libmysofa --enable-openal --enable-opencl --enable-opengl --disable-openssl --enable-pocketsphinx --enable-sndio --enable-sdl2 --enable-vapoursynth --enable-vulkan --enable-xlib --enable-zlib --enable-amf --enable-cuda-nvcc --enable-cuda-llvm --enable-cuvid --enable-ffnvcodec --enable-libdrm --enable-libmfx --enable-libnpp --enable-nvdec --enable-nvenc --enable-omx --enable-rkmpp --enable-v4l2-m2m --enable-vaapi --enable-vdpau
libavutil      57. 28.100 / 57. 28.100
libavcodec     59. 37.100 / 59. 37.100
libavformat    59. 27.100 / 59. 27.100
libavdevice    59.  7.100 / 59.  7.100
libavfilter     8. 44.100 /  8. 44.100
libswscale      6.  7.100 /  6.  7.100
libswresample   4.  7.100 /  4.  7.100
libpostproc    56.  6.100 / 56.  6.100

It does use a forked modified version of ffmpeg (which is usually a few releases behind the offical - not sure how old it is currently, but they publish the source so you can always go digging if you really want to know) so the changes may not be a easy as you think.

1 Like

Thank you so much for wasting so much time helping me and staying in communication with me.
Yes, it is likely that the difficulty is indeed greater as you say.
I just don’t understand that I initially submitted to the feature request category, but no official Plex tech contacted me or replied, and then moved it to the current PMS - Server Linux category, with no positive reply until now, even though I provided a suspected official member on the second floor with a reply and some test samples to tell him there was something different – I didn’t realize at the time that this was just a codec name as ffmpeg calls itself.

Can I ask by the way, is there any way to directly request a technical work order from a cloud server manufacturer, similar to AWS, so that technicians can directly accept this problem?
?

Do you mean how do you officially request technical support from Plex ?

If so the only way is to post in the forum and hopefully an Plex team member may reply.

1 Like

@a632079

Morning.

It seems you’re having trouble using Plex on Arch Linux?

First, the bad news -

  1. PMS isn’t packaged / supported on Arch.
  2. Supported distributions are those with the DEB and RPM package managers

Not-so-bad:

  1. If you know how to extract DEB files, you can take the DEB apart and manually install it (probably what you Arch package maintainer did)

What we need:

  1. Make certain DEBUG server logging is enabled. (SAVE if you make changes)
  2. Play 30 seconds of session to recreate the startup
  3. Stop the playback
  4. Download the logs
  5. Attach the ZIP file here.

Good news (at last):

  1. TigerLake CPUs are supported natively by PMS.
  2. The Plex Transcoder, which is based on FFMPEG, brings everything needed with it.
  3. I see you’re using VMware. Does /dev/dri populate with ‘card0’ and ‘renderD128’ ?
    – the problem you have might be a simple ‘permissions’ problem due to the Arch installer. (logs will tell us)

Future – Instead of leading off with Emby and Jellyfin and complaining, How about asking for help next time?

INFO: Most of us work Mon - Fri.

2 Likes

Thank you for your reply. I’ve been waiting for you for too long! The reason why I post this post is actually very simple.

If Plex Media Server for Linux didn’t support QSV, a codec that FFMPEG does, then this would be a feature request - sadly it seems to be rejected by the administrators of the category there.

If this format is officially supported, I think we can investigate why Plex prefers VAAPI over QSV in Fedora.

Okay, let me add answers to your questions.

The Plex Transcoder, which is based on FFMPEG, brings everything needed with it.

  • Yeah, then we should be able to easily add codecs, such as QSV, support.

I see you’re using VMware. Does /dev/dri populate with ‘card0’ and ‘renderD128’ ?
– the problem you have might be a simple ‘permissions’ problem due to the Arch installer.

  • Yes, I run Fedora and ArchLinux in ESXI, as you can see #5, Plex hardware acceleration is available both on Fedora and ArchLinux.

Future – Instead of leading off with Emby and Jellyfin and complaining, How about asking for help next time?

  • Haha, that was indeed my fault. I didn’t know how to check how Plex was using the hardware accelerated codec at first, so I foolishly used the method of looking at the usage of different units of the GPU to guess what FFMPEG API Plex used - yes, we can now OK, we’re using VAAPI!
    • A notable feature of VAAPI is that it uses 3D units meaninglessly when encoding and decoding.

What we need:

  1. Make certain DEBUG server logging is enabled. (SAVE if you make changes)
  2. Play 30 seconds of session to recreate the startup
  3. Stop the playback
  4. Download the logs
  5. Attach the ZIP file here.

I also appreciate your willingness to take some time to reply me patiently these two days.

It seems that an official support person replied to me below, and I will continue to consult with him about this codec.

Thanks again!