Jump to content

Hardware accelerated transcoding with QuickSync


danergo
Go to solution Solved by Q-Droid,

Recommended Posts

danergo

Hi!

I'm running Emby Server on Linux, with Intel Core-i5 3470t.

According to Intel, this processor has QuickSync, and according to docs, Emby supports QuickSync on Linux.

But still, whenever I'm watching a movie needs to be transcoded, it's done by the CPU (all 4 cores are 100%).

I tried to determine if quicksync is active, and I found out, that:

 

$ ls /var/lib/emby-server/ffmpeg
20170308

$ /var/lib/emby-server/ffmpeg/20170308/ffmpeg -hide_banner -hwaccels
Hardware acceleration methods:
vaapi
cuvid

So: QuickSync (I think it shall be qsv) is clearly missing here. And ffmpeg seems quite outdated too.

Shall I manually compile and move an ffmpeg to this directory, or there is a better way to utilize QuickSync video with Emby?

On Linux (Ubuntu), is there a way to detect if QuickSync is indeed enabled and availabe in the system?

For Emby to utilize QuickSync, does FFMPEG needs to support it?

Oh and I have to mention, that this is a headless machine, so there might be packages missing which needs to utilize QS.

 

Thank you!

Edited by danergo
Link to comment
Share on other sites

danergo

Okay, so this was an older instance of Emby, and I have the real one in a different directory, which contains an up-2-date ffmpeg, with qsv support:

 

/opt/emby-server/bin$ ./emby-ffmpeg -hwaccels
ffmpeg version 5.0.0-emby_2022_05_07 Copyright (c) 2000-2022 the FFmpeg developers and softworkz for Emby LLC
  built with gcc 8.3.0 (crosstool-NG 1.24.0)
Execution Date: 2023-02-06 21:35:08
Hardware acceleration methods:
cuda
vaapi
qsv
drm
opencl
vulkan

So now, the real question is, why is not qsv handling the transcoding?

 

Shouldn't be something displayed in here?

image.png.ced2fcdcea485bace6f537aa457d78ac.png

Link to comment
Share on other sites

Quote

For Emby to utilize QuickSync, does FFMPEG needs to support it?

Yes, and the ffmpeg build we embed in our packages does support it.

Link to comment
Share on other sites

Q-Droid

It looks like Emby can't access/open the render device. What user is running the Emby server?

Run:

id emby or id <runtime user>

ls -la /dev/dri

 

 

Link to comment
Share on other sites

danergo

Hi, here are my results:

$ id emby
uid=111(emby) gid=117(emby) groups=117(emby),44(video),1000(xyz),118(debian-transmission),126(render)

$ id xyz
uid=1000(xyz) gid=1000(xyz) groups=1000(xyz),4(adm),24(cdrom),27(sudo)
7(emby),118(debian-transmission)

$ ls -la /dev/dri
total 0
drwxr-xr-x  3 root root      80 Oct  9 10:10 .
drwxr-xr-x 24 root root    4760 Jan 10 11:26 ..
drwxr-xr-x  2 root root      60 Oct  9 10:10 by-path
crw-rw----  1 root video 226, 0 Oct  9 10:10 card0

It seems video group has read-write access on card0, shall I change this to something else?

 

Thank you!

Edited by danergo
Link to comment
Share on other sites

danergo
$ ls -la /var/lib/emby/logs
total 31788
drwxrwxr-x  2 emby emby   12288 Feb  8 00:00 .
drwxr-xr-x 18 emby emby    4096 Feb 23  2021 ..
-rw-r--r--  1 emby emby 6643455 Feb  4 23:59 embyserver-63811151999.txt
-rw-r--r--  1 emby emby 6982801 Feb  5 23:59 embyserver-63811238400.txt
-rw-r--r--  1 emby emby 7005724 Feb  6 23:59 embyserver-63811324800.txt
-rw-r--r--  1 emby emby   83226 Feb  7 06:48 embyserver-63811349339.txt
-rw-r--r--  1 emby emby   50097 Feb  7 06:51 embyserver-63811349468.txt
-rw-r--r--  1 emby emby   38102 Feb  7 06:51 embyserver-63811349506.txt
-rw-r--r--  1 emby emby 7405671 Feb  7 23:59 embyserver-63811411200.txt
-rw-r--r--  1 emby emby 3738267 Feb  8 13:55 embyserver.txt
-rw-r--r--  1 emby emby   14970 Feb  5 13:00 ffmpeg-transcode-473e0f7a-e
465-4d13-8692-e61b6ab4d541_1.txt
-rw-r--r--  1 emby emby   33668 Feb  6 20:51 ffmpeg-transcode-cf28acb5-1
7a1-47a9-8ad3-ed11bed6e98e_1.txt
-rw-r--r--  1 emby emby   19277 Feb  6 21:34 ffmpeg-transcode-eddb42ec-c
953-4d89-bdc9-18530a6f46e0_1.txt
-rw-r--r--  1 emby emby   41161 Feb  6 21:33 ffmpeg-transcode-f00403a4-a
ae0-4a72-bd8d-aa0590238020_1.txt
-rw-r--r--  1 emby emby  138348 Feb  7 06:49 hardware_detection-63811349
345.txt
-rw-r--r--  1 emby emby  138373 Feb  7 06:51 hardware_detection-63811349
501.txt
-rw-r--r--  1 emby emby  138373 Feb  7 06:51 hardware_detection-63811349
512.txt

Xyz is me. :)

My logs are in /var/lib/Emby/logs, PLS see above.

 

Thank you!

 

Link to comment
Share on other sites

Q-Droid

The basic stuff looks good so this could be a kernel module not loading or the CPU age. I'll have to dig up some of my troubleshooting posts. 

 

Link to comment
Share on other sites

Q-Droid

Run these when you get a chance and post the output.

$ lspci

$ dmesg | grep -iE 'drm|i915|vga'

$ lsmod | grep -iE 'drm|i915'

 

Link to comment
Share on other sites

danergo

Hi!

Sure, here we go:

$ lspci
00:00.0 Host bridge: Intel Corporation Xeon E3-1200 v2/3rd Gen Core processor DRAM Controller (rev 09)
00:01.0 PCI bridge: Intel Corporation Xeon E3-1200 v2/3rd Gen Core processor PCI Express Root Port (rev 09)
00:06.0 PCI bridge: Intel Corporation Xeon E3-1200 v2/3rd Gen Core processor PCI Express Root Port (rev 09)
00:1a.0 USB controller: Intel Corporation 6 Series/C200 Series Chipset Family USB Enhanced Host Controller #2 (rev 05)
00:1c.0 PCI bridge: Intel Corporation 6 Series/C200 Series Chipset Family PCI Express Root Port 1 (rev b5)
00:1c.4 PCI bridge: Intel Corporation 6 Series/C200 Series Chipset Family PCI Express Root Port 5 (rev b5)
00:1c.6 PCI bridge: Intel Corporation 6 Series/C200 Series Chipset Family PCI Express Root Port 7 (rev b5)
00:1c.7 PCI bridge: Intel Corporation 6 Series/C200 Series Chipset Family PCI Express Root Port 8 (rev b5)
00:1d.0 USB controller: Intel Corporation 6 Series/C200 Series Chipset Family USB Enhanced Host Controller #1 (rev 05)
00:1e.0 PCI bridge: Intel Corporation 82801 PCI Bridge (rev a5)
00:1f.0 ISA bridge: Intel Corporation C204 Chipset LPC Controller (rev 05)
00:1f.2 RAID bus controller: Intel Corporation 6 Series/C200 Series Desktop SATA RAID Controller (rev 05)
01:00.0 System peripheral: Hewlett-Packard Company Integrated Lights-Out Standard Slave Instrumentation & System Support (rev 05)
01:00.1 VGA compatible controller: Matrox Electronics Systems Ltd. MGA G200EH
01:00.2 System peripheral: Hewlett-Packard Company Integrated Lights-Out Standard Management Processor Support and Messaging (rev 05)
01:00.4 USB controller: Hewlett-Packard Company Integrated Lights-Out Standard Virtual USB Controller (rev 02)
02:00.0 Memory controller: Hewlett Packard Enterprise Device 005f
03:00.0 Ethernet controller: Broadcom Inc. and subsidiaries NetXtreme BCM5720 2-port Gigabit Ethernet PCIe
03:00.1 Ethernet controller: Broadcom Inc. and subsidiaries NetXtreme BCM5720 2-port Gigabit Ethernet PCIe
04:00.0 USB controller: Renesas Technology Corp. uPD720201 USB 3.0 Host Controller (rev 03)

$ dmesg | grep -iE 'drm|i915|vga'
[    0.211506] pci 0000:01:00.1: vgaarb: setting as boot VGA device
[    0.211506] pci 0000:01:00.1: vgaarb: VGA device added: decodes=io+mem,owns=io+mem,locks=none
[    0.211506] pci 0000:01:00.1: vgaarb: bridge control possible
[    0.211506] vgaarb: loaded
[    0.554458] fb0: VESA VGA frame buffer device
[    1.064845] fb0: switching to mgag200drmfb from VESA VGA
[    1.064935] mgag200 0000:01:00.1: vgaarb: deactivate vga console
[    1.144884] fbcon: mgag200drmfb (fb0) is primary device
[    1.144890] mgag200 0000:01:00.1: fb0: mgag200drmfb frame buffer device
[    1.157879] [drm] Initialized mgag200 1.0.0 20110418 for 0000:01:00.1 on minor 0
[    5.811847] systemd[1]: Condition check resulted in Load Kernel Module drm being skipped.

$ lsmod | grep -iE 'drm|i915'
drm_vram_helper        20480  1 mgag200
ttm                   106496  1 drm_vram_helper
drm_kms_helper        184320  3 mgag200
syscopyarea            16384  1 drm_kms_helper
sysfillrect            16384  1 drm_kms_helper
sysimgblt              16384  1 drm_kms_helper
fb_sys_fops            16384  1 drm_kms_helper
drm                   491520  5 drm_kms_helper,drm_vram_helper,mgag200,ttm

 

Link to comment
Share on other sites

Q-Droid

Wait a minute. Do you have an i5 or a Xeon? The kernel is detecting a Xeon and Matrox video. You might want to double check your hardware. Only some Xeon models have iGPU. 

Edited by Q-Droid
Link to comment
Share on other sites

danergo
16 minutes ago, Q-Droid said:

Wait a minute. Do you have an i5 or a Xeon? The kernel is detecting a Xeon and Matrox video. You might want to double check your hardware. Only some Xeon models have iGPU. 

I had Celeron (don't remember which one), and then last year I replaced it with "Intel Core i5-3470T".

Link to comment
Share on other sites

danergo
11 minutes ago, Happy2Play said:

Doesn't this apply?

 

Definitely, it's a 3rd gen processor.

Sorry, but it's getting too late here to get the nuts from this massive thread: is it an easy way to activate it, or I'll have to deepdive into it to make it work?


Thanks!

Link to comment
Share on other sites

Q-Droid
9 minutes ago, Happy2Play said:

Doesn't this apply?

 

Not necessarily. Even if qsv is not supported vaapi remains an option for the older Gen Intel CPUs. But Emby will definitely not show any HW options until the OS can properly detect and present the hardware. 

If @danergo does indeed have an i5 then the OS detection has to be fixed before Emby can do its thing. Can you check somewhere else, like in bios, to verify you do have an i5? 

Link to comment
Share on other sites

Q-Droid

In that case since your OS is detecting an additional graphics adapter make sure the integrated graphics are also enabled in the bios. Sometimes it named multi-display or IGD multi-monitor, force enable iGPU, or something along those lines.

 

Link to comment
Share on other sites

danergo
$ lscpu
Architecture:                    x86_64
CPU op-mode(s):                  32-bit, 64-bit
Byte Order:                      Little Endian
Address sizes:                   36 bits physical, 48 bits virtual
CPU(s):                          4
On-line CPU(s) list:             0-3
Thread(s) per core:              2
Core(s) per socket:              2
Socket(s):                       1
NUMA node(s):                    1
Vendor ID:                       GenuineIntel
CPU family:                      6
Model:                           58
Model name:                      Intel(R) Core(TM) i5-3470T CPU @ 2.90GHz
Stepping:                        9
CPU MHz:                         1596.388
CPU max MHz:                     3600.0000
CPU min MHz:                     1600.0000
BogoMIPS:                        5786.60
Virtualization:                  VT-x
L1d cache:                       64 KiB
L1i cache:                       64 KiB
L2 cache:                        512 KiB
L3 cache:                        3 MiB
NUMA node0 CPU(s):               0-3
Vulnerability Itlb multihit:     KVM: Mitigation: Split huge pages
Vulnerability L1tf:              Mitigation; PTE Inversion; VMX conditional cache flushes, SMT vulnerable
Vulnerability Mds:               Mitigation; Clear CPU buffers; SMT vulnerable
Vulnerability Meltdown:          Mitigation; PTI
Vulnerability Mmio stale data:   Not affected
Vulnerability Spec store bypass: Mitigation; Speculative Store Bypass disabled via prctl and seccomp
Vulnerability Spectre v1:        Mitigation; usercopy/swapgs barriers and __user pointer sanitization
Vulnerability Spectre v2:        Mitigation; Retpolines, IBPB conditional, IBRS_FW, STIBP conditional, RSB filling
Vulnerability Srbds:             Vulnerable: No microcode
Vulnerability Tsx async abort:   Not affected
Flags:                           fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nons
                                 top_tsc cpuid aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm cpuid_fault epb pti
                                 ssbd ibrs ibpb stibp tpr_shadow vnmi flexpriority ept vpid fsgsbase smep erms xsaveopt dtherm ida arat pln pts md_clear flush_l1d

 

Link to comment
Share on other sites

danergo

Guys sorry, this is server, which by default prioritizes its onboard video, therefore i965 is simply not visible to OS.

I'll try to fix this and get back here.

Link to comment
Share on other sites

danergo

Hi!

I have changed the video configuration in BIOS, but it's quite the same:

$ lspci
00:00.0 Host bridge: Intel Corporation Xeon E3-1200 v2/3rd Gen Core processor DRAM Controller (rev 09)
00:01.0 PCI bridge: Intel Corporation Xeon E3-1200 v2/3rd Gen Core processor PCI Express Root Port (rev 09)
00:06.0 PCI bridge: Intel Corporation Xeon E3-1200 v2/3rd Gen Core processor PCI Express Root Port (rev 09)
00:1a.0 USB controller: Intel Corporation 6 Series/C200 Series Chipset Family USB Enhanced Host Controller #2 (rev 05)
00:1c.0 PCI bridge: Intel Corporation 6 Series/C200 Series Chipset Family PCI Express Root Port 1 (rev b5)
00:1c.4 PCI bridge: Intel Corporation 6 Series/C200 Series Chipset Family PCI Express Root Port 5 (rev b5)
00:1c.6 PCI bridge: Intel Corporation 6 Series/C200 Series Chipset Family PCI Express Root Port 7 (rev b5)
00:1c.7 PCI bridge: Intel Corporation 6 Series/C200 Series Chipset Family PCI Express Root Port 8 (rev b5)
00:1d.0 USB controller: Intel Corporation 6 Series/C200 Series Chipset Family USB Enhanced Host Controller #1 (rev 05)
00:1e.0 PCI bridge: Intel Corporation 82801 PCI Bridge (rev a5)
00:1f.0 ISA bridge: Intel Corporation C204 Chipset LPC Controller (rev 05)
00:1f.2 RAID bus controller: Intel Corporation 6 Series/C200 Series Desktop SATA RAID Controller (rev 05)
01:00.0 System peripheral: Hewlett-Packard Company Integrated Lights-Out Standard Slave Instrumentation & System Support (rev 05)
01:00.1 VGA compatible controller: Matrox Electronics Systems Ltd. MGA G200EH
01:00.2 System peripheral: Hewlett-Packard Company Integrated Lights-Out Standard Management Processor Support and Messaging (rev 05)
01:00.4 USB controller: Hewlett-Packard Company Integrated Lights-Out Standard Virtual USB Controller (rev 02)
02:00.0 Memory controller: Hewlett Packard Enterprise Device 005f
03:00.0 Ethernet controller: Broadcom Inc. and subsidiaries NetXtreme BCM5720 2-port Gigabit Ethernet PCIe
03:00.1 Ethernet controller: Broadcom Inc. and subsidiaries NetXtreme BCM5720 2-port Gigabit Ethernet PCIe
04:00.0 USB controller: Renesas Technology Corp. uPD720201 USB 3.0 Host Controller (rev 03)

$ lsmod | grep -iE 'drm|i915'
drm_vram_helper        20480  1 mgag200
ttm                   106496  1 drm_vram_helper
drm_kms_helper        184320  3 mgag200
syscopyarea            16384  1 drm_kms_helper
sysfillrect            16384  1 drm_kms_helper
sysimgblt              16384  1 drm_kms_helper
fb_sys_fops            16384  1 drm_kms_helper
drm                   495616  5 drm_kms_helper,drm_vram_helper,mgag200,ttm

$ dmesg | grep -iE 'drm|i915|vga'
[    0.210938] pci 0000:01:00.1: vgaarb: setting as boot VGA device
[    0.210938] pci 0000:01:00.1: vgaarb: VGA device added: decodes=io+mem,owns=io+mem,locks=none
[    0.210938] pci 0000:01:00.1: vgaarb: bridge control possible
[    0.210938] vgaarb: loaded
[    0.638533] fb0: VESA VGA frame buffer device
[    1.189405] fb0: switching to mgag200drmfb from VESA VGA
[    1.189517] mgag200 0000:01:00.1: vgaarb: deactivate vga console
[    1.273721] fbcon: mgag200drmfb (fb0) is primary device
[    1.273728] mgag200 0000:01:00.1: fb0: mgag200drmfb frame buffer device
[    1.301846] [drm] Initialized mgag200 1.0.0 20110418 for 0000:01:00.1 on minor 0
[    6.104815] systemd[1]: Condition check resulted in Load Kernel Module drm being skipped.

 

However now I can do:

$ sudo modprobe i915
...

$ lsmod | grep -iE 'drm|i915'
i915                 1998848  0
video                  57344  1 i915
drm_vram_helper        20480  1 mgag200
i2c_algo_bit           16384  2 mgag200,i915
ttm                   106496  1 drm_vram_helper
drm_kms_helper        184320  4 mgag200,i915
syscopyarea            16384  1 drm_kms_helper
sysfillrect            16384  1 drm_kms_helper
sysimgblt              16384  1 drm_kms_helper
fb_sys_fops            16384  1 drm_kms_helper
drm                   495616  6 drm_kms_helper,drm_vram_helper,mgag200,i915,ttm

But, Emby is still not seeing neither the decoder nor the encoder hardwares.

Is there anything else I can try? (I tried systemctl restart emby)

 

Thank you!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...