My machine is a ThinkPad W550s, with an i7-5500U CPU and Intel HD
Graphics 5500. Hardware decoding of video works fine with mpv (using
vaapi), but not with vlc:

mpv without hardware decoding:

$ time mpv Rogue\ One\ -\ A\ Star\ Wars\ Story\ -\ Trailer.mp4 
Playing: Rogue One - A Star Wars Story - Trailer.mp4
[ffmpeg/demuxer] mov,mp4,m4a,3gp,3g2,mj2: stream 0, timescale not set
 (+) Video --vid=1 (*) (h264)
     Video --vid=2 [P] (mjpeg)
 (+) Audio --aid=1 --alang=eng (*) (aac)

...

AO: [alsa] 48000Hz stereo 2ch float
VO: [opengl] 1920x816 yuv420p
AV: 00:02:06 / 00:02:06 (99%) A-V:  0.000

...

real    2m6.828s
user    0m36.432s
sys     0m1.356s

mpv with hardware decoding:

$ time mpv --hwdec=vaapi Rogue\ One\ -\ A\ Star\ Wars\ Story\ -\ Trailer.mp4 
Playing: Rogue One - A Star Wars Story - Trailer.mp4
[ffmpeg/demuxer] mov,mp4,m4a,3gp,3g2,mj2: stream 0, timescale not set
 (+) Video --vid=1 (*) (h264)
     Video --vid=2 [P] (mjpeg)
 (+) Audio --aid=1 --alang=eng (*) (aac)

...

libva info: VA-API version 0.39.4
libva info: va_getDriverName() returns 0
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/i965_drv_video.so
libva info: Found init function __vaDriverInit_0_39
libva info: va_openDriver() returns 0
AO: [alsa] 48000Hz stereo 2ch float
Using hardware decoding (vaapi).
VO: [opengl] 1920x816 vaapi
AV: 00:02:06 / 00:02:06 (99%) A-V:  0.000

...

real    2m7.019s
user    0m3.224s
sys     0m1.608s

[Note the decrease in CPU usage ("user").]

With vlc, the CPU usage remains roughly the same (high), regardless
of whether hardware decoding is enabled or not.

vlc without hardware decoding:

$ time vlc Rogue\ One\ -\ A\ Star\ Wars\ Story\ -\ Trailer.mp4 
VLC media player 3.0.2 Vetinari (revision 3.0.2-0-gd7b653cf14)
[000055aad94521a0] main libvlc: Running vlc with the default interface. Use 
'cvlc' to use vlc without interface.
QObject::~QObject: Timers cannot be stopped from another thread

real    2m20.461s
user    0m43.796s
sys     0m1.292s

vlc with hardware decoding:

$ time vlc --avcodec-hw vaapi Rogue\ One\ -\ A\ Star\ Wars\ Story\ -\ 
Trailer.mp4 
VLC media player 3.0.2 Vetinari (revision 3.0.2-0-gd7b653cf14)
[00005586746a81a0] main libvlc: Running vlc with the default interface. Use 
'cvlc' to use vlc without interface.
QObject::~QObject: Timers cannot be stopped from another thread

real    2m10.894s
user    0m43.276s
sys     0m1.808s

I've tried other values for --avcodec, as well as enabling hardware
acceleration from the GUI, to no avail - I get no reduction in CPU
usage.

The Arch Wiki indeed claims that hardware decoding only works with mpv,
and not with vlc:

https://wiki.archlinux.org/index.php/Mpv#Hardware_decoding

But vlc's own documentation claims that hardware decoding should work:

https://wiki.videolan.org/VLC_GPU_Decoding

Trying to figure out hardware decoding is pretty frustrating - the web
seems full of inconsistent, outdated, and just plain wrong information.
Any ideas?

Celejar

Reply via email to