Skip to content

VAAPI vs. QSV whats the option for hardware decoding #304

Closed

Description

@TheSashmo

Coming back to UG after a long pause. Trying to get hardware accelerated encoding and decoding on Ubuntu 20.04 with decklink in and out.

I can't seem to get any of the QSV stuff to work. It spits out errors of wrong pixel format, but no matter what I try it wont kick in.

I am able to get the vaapi encoding working just fine. Both h264 and hevc. The problem is I want to get the decoder to use hardware acceleration too, but the only option that I have is h264_qsv and hevc_qsv and both of those don't work.

vainfo tells me:
user@box:~# vainfo
wl_drm@7: error 0: authenticate failed
VA error: wayland: Wayland roundtrip error: Protocol error (errno 71)
libva info: VA-API version 1.7.0
libva error: vaGetDriverNameByIndex() failed with invalid VADisplay, driver_name = (null)
vaInitialize failed with error code 3 (invalid VADisplay),exit

but if I run this: vainfo --display drm --device /dev/dri/renderD128

this works:
libva info: VA-API version 1.7.0
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/iHD_drv_video.so
libva info: Found init function __vaDriverInit_1_7
libva info: va_openDriver() returns 0
vainfo: VA-API version: 1.7 (libva 2.6.0)
vainfo: Driver version: Intel iHD driver for Intel(R) Gen Graphics - 20.1.1 ()
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
VAProfileVP8Version0_3 : VAEntrypointEncSlice
VAProfileHEVCMain : VAEntrypointVLD
VAProfileHEVCMain : VAEntrypointEncSlice
VAProfileHEVCMain : VAEntrypointFEI
VAProfileHEVCMain10 : VAEntrypointVLD
VAProfileHEVCMain10 : VAEntrypointEncSlice
VAProfileVP9Profile0 : VAEntrypointVLD
VAProfileVP9Profile2 : VAEntrypointVLD

So if anyone can give me some insight on how to make the QSV work so that I can use hardware decoding, that would be great, thanks in advance!

Activity

  1. alatteri commented on Apr 6, 2023

    @alatteri

    We use NUC12 platform for hardware HEVC-QSV encode and decode. At least for NUC12 which has Xe graphics these are the guidelines.

    1. make sure to use the latest release or Continous AppImage
    2. Use kernel 5.19 or later
    3. Install OneVPL
        wget -qO - https://repositories.intel.com/graphics/intel-graphics.key | sudo gpg --batch --yes --dearmor --output /usr/share/keyrings/intel-graphics.gpg
        echo 'deb [arch=amd64 signed-by=/usr/share/keyrings/intel-graphics.gpg] https://repositories.intel.com/graphics/ubuntu jammy legacy' | sudo tee  /etc/apt/sources.list.d/intel.gpu.jammy.list
        sudo apt-get update
        sudo apt-get -y install intel-opencl-icd intel-level-zero-gpu level-zero intel-media-va-driver-non-free libmfx1 libmfxgen1 libvpl2
        
        sudo sh -c 'echo "options i915 enable_guc=2" > /etc/modprobe.d/i915.conf'
        sudo update-initramfs -u
    
    1. on decoder use --param use-hw-accel,force-lavd-decoder=hevc_qsv
    2. User that runs the UG app must be member of video,render and audio group.

    I think that is it.

  2. TheSashmo commented on Apr 6, 2023

    @TheSashmo
    Author

    Thanks I will try this now. I'll have to update the kernel to get there.....

  3. alatteri commented on Apr 6, 2023

    @alatteri

    But really, for HD, CPU encoding/decoding, should be no issue on modern CPU. QSV just add headache and less quality. We only use it for UHD, everything else is CPU.

  4. TheSashmo commented on Apr 6, 2023

    @TheSashmo
    Author

    It's a 10th gen box, and the CPU based h.264 is fine. I am trying to squeeze in hevc for some unique use cases when desperately needed.

  5. alatteri commented on Apr 6, 2023

    @alatteri

    2K or under, x265/hevc CPU only is fine. I've never been able to get UHD 12bit CPU only though. What unique cases do you have?

  6. TheSashmo commented on Apr 6, 2023

    @TheSashmo
    Author

    Well, thats interesting. I "believe" the machine is strong enough to handle it, but I have never been able to reliably get hevc to encode and decode on the machine. Maybe I should have mentioned that in the first place. My goal is encode and decode in one box. I can see my core usage is about 5 on a 8 core box, but it will never go up to full 100% usage for it. I'm assuming thats a hyper threading issue, because in theory its a 4 core machine, but hyper threaded to 8.

    I doing two way SDI tunnels over the internet with my own error correction algorithm "which is better than SRT BTW..." and I want to have one box that will do encode and decode at the same time.

  7. alatteri commented on Apr 6, 2023

    @alatteri

    Oh... that is a lighter CPU than I thought. We use Ryzen 16c/32t. What is different about your EC and how is it better than SRT?

  8. alatteri commented on Apr 8, 2023

    @alatteri

    @TheSashmo Not sure what your budget is, but a NUC12i7 utilizing QSV can encode/decode 4K UHD easily, and you can get one all in for around $800.

  9. TheSashmo commented on Apr 11, 2023

    @TheSashmo
    Author

    I'll pick up one of those to see if it eliminates my problems, but no matter what I do, I am seeing skipping frames on my output. Even on a server setup I get the same result. I'm starting to get frustrated a bit. Lets see if that NUC gets me over the hump. Thanks @alatteri . You going to NAB?

  10. alatteri commented on Apr 11, 2023

    @alatteri

    NAB isn't in the plan. I know pre-COVID some of the UG would go. Maybe they'll be back this year. But if you're in LA, buzz me up.

    I'll pick up one of those to see if it eliminates my problems, but no matter what I do, I am seeing skipping frames on my output. Even on a server setup I get the same result. I'm starting to get frustrated a bit. Lets see if that NUC gets me over the hump. Thanks @alatteri . You going to NAB?

  11. TheSashmo commented on Apr 11, 2023

    @TheSashmo
    Author

    @alatteri not to clutter up this thread, but I will be LA after NAB. Lets meet up for a coffee! Not sure if I ever saw a DM option in github. But DM me? LOLOLOL.

  12. alatteri commented on Apr 11, 2023

    @alatteri

    @alatteri not to clutter up this thread, but I will be LA after NAB. Let's meet up for a coffee! Not sure if I ever saw a DM option in github. But DM me? LOLOLOL.

    @TheSashmo
    Email me XXXXX

    I've removed my email address, to prevent data scrapers, now that Sashmo and I have connected. The rest of this thread can go back to the original issue.

  13. locked and limited conversation to collaborators on Sep 13, 2023
  14. converted this issue into a discussion #335 on Sep 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions