question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Support]: Need libmfxgen1 library installed to support Alder Lake CPU QSV transcoding

See original GitHub issue

Describe the problem you are having

I have an Alder Lake gen12 CPU that I’m utilizing QuickSync for hardware transcoding.

In order to use the qsv device, the Docker image needs to have libmfxgen1 installed as per the Intel compatibility matrix

The stock Docker image will fail to initialize the hardware encoder/decoders using qsv if this package is not installed (see general Ubuntu bug)

After adding the[ Intel repository](deb [arch=amd64] https://repositories.intel.com/graphics/ubuntu focal main) and installing libmfxgen1 via apt-get results in the ffmpeg instance being able to correctly utilize qsv.

Version

0.10.1-83481AF

Frigate config file

ffmpeg:
        hwaccel_args:
                - -hwaccel
                - qsv
                - -qsv_device
                - /dev/dri/renderD128
        output_args:
          record: -f segment -segment_time 10 -segment_format mp4 -reset_timestamps 1 -strftime 1 -c:v h264_qsv -c:a copy -an
        input_args:
                - -hide_banner
                - -avoid_negative_ts
                - make_zero
                - -fflags
                - +genpts+discardcorrupt+igndts
                - -rtsp_transport
                - tcp
                - -stimeout
                - 5000000
                - -analyzeduration
                - 2147483647
                - -probesize
                - 2147483647

Relevant log output

Error initializing an internal MFX session: unsupported (-3)

FFprobe output from your camera

.

Frigate stats

No response

Operating system

Other Linux

Install method

Docker Compose

Coral version

M.2

Network connection

Wired

Camera make and model

.

Any other information that may be helpful

No response

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:22 (9 by maintainers)

github_iconTop GitHub Comments

2reactions
charlesmungercommented, Jul 22, 2022

Ok, I got qsv hwaccel “working” on beta7 with this config:

  hwaccel_args:
    - -hwaccel
    - qsv
    - -qsv_device
    - /dev/dri/renderD128
    - -hwaccel_output_format
    - qsv
    - -c:v
    - h264_qsv
    - -gpu_copy
    - "on"
  output_args:
    detect: -vf vpp_qsv=format=yuv420p -f rawvideo -pix_fmt yuv420p

This does result in CPU improvement and I do see activity in intel_gpu_top. I think for Alder Lake on linux, qsv doesn’t support yuv420p as a hwdownload format (it does support nv12!), so we need a second pass to convert it to yuv420p in hardware, then use -gpu_copy for accelerated copy from the hardware memory to software. With this set up, each 640x480 7fps reolink detect steam uses 3% of one E-core on my 12700.

I also tried -vf hwdownload,format=nv12,format=yuv420p and it worked, but it it used slightly more CPU than the vpp_qsv configuration, plus I suspect it’s less portable since it’s not really documented which formats are supported for direct hwdownload with which drivers and hardware.

I think we should consider updating the docs since I suspect that users of that configuration are not actually getting hardware acceleration - if I didn’t specify -c:v h264_qsv then I got no errors… but it wasn’t actually using hardware acceleration.

I was also tripped up by the yaml converting on to True implicitly, so I had to add those quotes.

1reaction
jasonmadigancommented, Jul 26, 2022

Update: nevermind, think I figured it out. Unraid currently (6.10.3) uses kernel 5.15.46. Knew it had a number of issues with the iGPU from various threads. Updated to a test build of Unraid, 6.11.0-beta9, which includes a new 5.18.12 kernel. QSV works again, with your config from above (and can also see load again via the GPU). Thanks @charlesmunger

Where does one find information on Unraid 6.11 beta? haven’t seen anything on it

It’s in test, Unraid don’t seem to publicise these as much as the RCs, but there were some links shared on their forums by someone.

Install Plugin > https://s3.amazonaws.com/dnld.lime-technology.com/test/unRAIDServer.plg

Read more comments on GitHub >

github_iconTop Results From Across the Web

Qsv errors when transcoding on Intel 12th Gen platform - Emby
I'll get an Alder Lake system in a few days, then I'll be able to reproduce (hopefully). There have been huge changes in...
Read more >
Intel ARC Transcoding Support : r/jellyfin - Reddit
Being able to also maybe move some of my library to av1 and then transcode to another format if it's not supported by...
Read more >
ffmpeg depends on libmfx-gen1.2 on Alder Lake for Intel QSV ...
On Intel 12th gen CPUs (Alder Lake), ffmpeg requires package libmfx-gen1.2 to use QSV hardware decoding/encoding, but it's not marked as a ...
Read more >
Alder Lake GVT-d integrated graphics passthrough
I have been following GVT-g tutorials, but have come to the realization that 10th gen and up Intel CPUs do not support GVT-g...
Read more >
Intel 12th generation Alder Lake / Hybrid CPU - Page 7
If you are just looking for increased security and support for the ... iGPU support for QSV/transcoding, and for additional 2.5GbE support, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found