How to watch videos with GPU assistance
Posted: 27 Mar 2017, 01:55
This tutorial explains how to move the load from CPU to GPU when watching videos. This is specially useful if you:
1- don't have a CPU powerful enough to handle heavy videos;
2- want to reduce CPU fan speed/noise;
3- want to watch videos while doing some heavy CPU task on the background;
4- want to save energy/battery life once GPU decoding is more optimized than CPU decoding;
5- are a geek and just want to try new technologies
I recommend using SMPlayer as the frontend (i.e. graphic interface) and Mpv as backend (i.e. video engine-player). However you can try different combinations, like pure Mpv or SMPlayer + MPlayer or Vlc, etc.
---Intel Cards---
You need both libva and libva-intel-driver:
http://www.mediafire.com/file/qi8jvi3t8 ... x86_64.xzm
http://www.mediafire.com/file/p204l75n8 ... x86_64.xzm
After loading both modules, go to the terminal and run:
If you see something similar to this you're good to go:
If you can't see any supported profile/entrypoints, you're probably missing some dependency. In this case, run the following commands and check what's missing:
Please, note that 'libva.so.1.3904.0' is the current libva-intel-driver version used in the first version of this tutorial. Maybe you need to check what's the version you have downloaded and run ldd pointing to the actual file name.
---Nvidia Cards---
Both Nvidia proprietary drivers and Mesa drivers already come with vdpau lib, so you don't need to load any additional module.
---AMD/ATI Cards---
I don't have a card from this brand, but you can check this Arch tutorial and see if it.
---Configuring SMPlayer player---
Now you need to set SMPlayer to use GPU assistance. Go to Preferences -> Performance -> Decoding -> Hardware decoding and:
If you're using an Intel video card, set 'vaapi'
If you're using a Nvidia video card, set 'vdpau'
---Testing---
Now try to watch really heavy videos, like Bug Buck Bunny 4k @ 60 FPS or Crowd Run 4k @ 50 FPS and see if CPU usage is always bellow 10%.
To make sure everything is in place, call Mpv directly from terminal passing the correct flag according to your video card:
Intel:
Nvidia or AMD/ATI:
Mpv should print something like this:
1- don't have a CPU powerful enough to handle heavy videos;
2- want to reduce CPU fan speed/noise;
3- want to watch videos while doing some heavy CPU task on the background;
4- want to save energy/battery life once GPU decoding is more optimized than CPU decoding;
5- are a geek and just want to try new technologies
I recommend using SMPlayer as the frontend (i.e. graphic interface) and Mpv as backend (i.e. video engine-player). However you can try different combinations, like pure Mpv or SMPlayer + MPlayer or Vlc, etc.
---Intel Cards---
You need both libva and libva-intel-driver:
http://www.mediafire.com/file/qi8jvi3t8 ... x86_64.xzm
http://www.mediafire.com/file/p204l75n8 ... x86_64.xzm
After loading both modules, go to the terminal and run:
Code: Select all
vainfo
Code: Select all
libva info: VA-API version 0.39.4
libva info: va_getDriverName() returns 0
libva info: Trying to open /usr/lib64/dri/i965_drv_video.so
libva info: Found init function __vaDriverInit_0_39
libva info: va_openDriver() returns 0
vainfo: VA-API version: 0.39 (libva 1.7.3)
vainfo: Driver version: Intel i965 driver for Intel(R) Kabylake - 1.7.3
vainfo: Supported profile and entrypoints
VAProfileMPEG2Simple : VAEntrypointVLD
VAProfileMPEG2Simple : VAEntrypointEncSlice
VAProfileMPEG2Main : VAEntrypointVLD
VAProfileMPEG2Main : VAEntrypointEncSlice
VAProfileH264ConstrainedBaseline: VAEntrypointVLD
VAProfileH264ConstrainedBaseline: VAEntrypointEncSlice
VAProfileH264Main : VAEntrypointVLD
VAProfileH264Main : VAEntrypointEncSlice
VAProfileH264High : VAEntrypointVLD
VAProfileH264High : VAEntrypointEncSlice
VAProfileH264MultiviewHigh : VAEntrypointVLD
VAProfileH264MultiviewHigh : VAEntrypointEncSlice
VAProfileH264StereoHigh : VAEntrypointVLD
VAProfileH264StereoHigh : VAEntrypointEncSlice
VAProfileVC1Simple : VAEntrypointVLD
VAProfileVC1Main : VAEntrypointVLD
VAProfileVC1Advanced : VAEntrypointVLD
VAProfileNone : VAEntrypointVideoProc
VAProfileJPEGBaseline : VAEntrypointVLD
VAProfileJPEGBaseline : VAEntrypointEncPicture
VAProfileVP8Version0_3 : VAEntrypointVLD
VAProfileVP8Version0_3 : VAEntrypointEncSlice
VAProfileHEVCMain : VAEntrypointVLD
VAProfileHEVCMain : VAEntrypointEncSlice
VAProfileHEVCMain10 : VAEntrypointVLD
VAProfileHEVCMain10 : VAEntrypointEncSlice
VAProfileVP9Profile0 : VAEntrypointVLD
VAProfileVP9Profile0 : VAEntrypointEncSlice
VAProfileVP9Profile2 : VAEntrypointVLD
Code: Select all
ldd /usr/lib64/dri/i965_drv_video.so
Code: Select all
ldd /usr/lib64/libva.so.1.3904.0
---Nvidia Cards---
Both Nvidia proprietary drivers and Mesa drivers already come with vdpau lib, so you don't need to load any additional module.
---AMD/ATI Cards---
I don't have a card from this brand, but you can check this Arch tutorial and see if it.
---Configuring SMPlayer player---
Now you need to set SMPlayer to use GPU assistance. Go to Preferences -> Performance -> Decoding -> Hardware decoding and:
If you're using an Intel video card, set 'vaapi'
If you're using a Nvidia video card, set 'vdpau'
---Testing---
Now try to watch really heavy videos, like Bug Buck Bunny 4k @ 60 FPS or Crowd Run 4k @ 50 FPS and see if CPU usage is always bellow 10%.
To make sure everything is in place, call Mpv directly from terminal passing the correct flag according to your video card:
Intel:
Code: Select all
mpv path_to_the_video --hwdec vaapi
Code: Select all
mpv path_to_the_video --hwdec vdpau
Code: Select all
Using hardware decoding (vaapi).
VO: [opengl] 1920x1080 vaapi