3

I've found that VLC uses ~17% CPU for x264 FHD videos, ~28% for HEVC FHD videos, and ~80% for HEVC 4k videos.

sudo lshw -c video

produces..

  *-display                 
       description: VGA compatible controller
       product: Cezanne
       vendor: Advanced Micro Devices, Inc. [AMD/ATI]
       physical id: 0
       bus info: pci@0000:04:00.0
       logical name: /dev/fb0
       version: c3
       width: 64 bits
       clock: 33MHz
       capabilities: pm pciexpress msi msix vga_controller bus_master cap_list fb
       configuration: depth=32 driver=amdgpu latency=0 resolution=3840,2160
       resources: irq:40 memory:d0000000-dfffffff memory:e0000000-e01fffff ioport:e000(size=256) memory:fcc00000-fcc7ffff

Processor: AMD® Ryzen 5 5560u with radeon graphics × 12

Graphics: RENOIR (renoir, LLVM 15.0.6, DRM 3.47, 5.19.0-35-generic)

deanresin
  • 537
  • 1
  • 6
  • 22

2 Answers2

5

To simply cite another site:

  • In Settings/Preferences
  • look for Input/Codecs tab
  • check out the option Hardware-accelerated decoding
  • select the Automatic option and you are fine

( please comment if you have trouble ;) )

  • 2
    I disabled it and I was still getting ~80% CPU usage playing a HEVC 4k video which leads me to believe it is not using hardware acceleration. – deanresin Mar 13 '23 at 01:58
5

The solution for me was...

sudo apt remove vlc

then...

sudo apt install mpv

I now get consistent ~8% CPU usage playing UHD HEVC videos vs. ~80% with VLC.

deanresin
  • 537
  • 1
  • 6
  • 22
  • 5
    No need to remove `vlc`, `mpv` can use hardware acceleration even if VLC is still installed. – pts Mar 13 '23 at 12:43
  • 1
    You probably also want to edit `~/.config/mpv/mpv.conf` or `~/.mpv/mpv.conf` with `profile=gpu-hq` and `hwdec=auto` if not already enabled. I've been using MPV for years, so I don't know how much of my config file is still needed, but I also had to set `hwdec-codecs=hevc,vp8,vp9,mpeg1video,mpeg2video,h264,vc1,wmv3` which is appropriate for my Skylake iGPU. (I much prefer MPV to VLC anyway, with good key-binds for accurate seeking and single-stepping fwd / backward, and very fast startup from the command line.) – Peter Cordes Mar 13 '23 at 17:38
  • 1
    @pts Simply removing VLC is probably easier than finding out how that particular Linux desktop environment handles file type associations. – AndreKR Mar 13 '23 at 20:02
  • @PeterCordes I didn't need to specify hardware decoding in the conf file. It just did it automatically. – deanresin Mar 14 '23 at 06:16
  • @deanresin: IIRC, an old version of MPV maybe didn't do it by default for *all* the relevant codecs, like maybe by default for H.264 and H.265, but IIRC it wasn't doing HW decode for VC1 / WMV3 without manual config. Hopefully that's changed now, and it will HW decode for anything your HW supports. – Peter Cordes Mar 14 '23 at 11:52
  • 1
    Also, `profile=gpu-hq` is a good idea for video quality if your video hardware is fast enough, if the default is only `gpu`. It'll use a higher-quality scaling algorithm. (You might need to use a faster scaler for 2160p60 videos, if it can't push that many pixels.) That's separate from enabling HW decoding. – Peter Cordes Mar 14 '23 at 14:18