Bug 364959

Summary: I wish Kaffeine could use VAAPI and VDPAU hardware decoding for h264 streams
Product: [Applications] kaffeine Reporter: José JORGE <lists.jjorge>
Component: generalAssignee: Mauro Carvalho Chehab <mchehab>
Status: RESOLVED WAITINGFORINFO    
Severity: wishlist    
Priority: NOR    
Version First Reported In: unspecified   
Target Milestone: ---   
Platform: Mageia RPMs   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description José JORGE 2016-07-01 06:16:44 UTC
The bug #192490 says VDPAU works from 1.0.2 version, but it seems it was lost going to 2.x versions... as I could not find any option for that, and CPU use at 100% with image pauses shows that it is not used.
Comment 1 Mauro Carvalho Chehab 2016-07-01 09:45:07 UTC
Kaffeine 2.x uses libVlc as backend. Starting with libVlc versions 2.x, it supports both VAAPI and VDPAU natively. On versions 2.0.x, there is a parameter to enable. On versions 2.2.x and 3.0, it will use it by default, if the hardware supports. No extra option is needed.

The logic is actually the reverse: if VAAPI/VDPAU can't be used for whatever reason, it will display this warning:
Failed to open VDPAU backend libvdpau_va_gl.so: cannot open shared object file: No such file or directory
Comment 2 Mauro Carvalho Chehab 2016-07-01 09:52:45 UTC
> CPU use at 100% with image pauses shows that it is not used.

When image is paused, there won't be any mpeg decoding. Instead, it will be writing the stream at the disk. With regards to cpu usage at "x%", never trust on top to measure the CPU utilization. What the Kernel actually measures is the amount of time that the task scheduler is busy, e. g. when detects that there's nothing to do, it sleeps and the CPU "usage" decreases. If you have any process that is continuously receiving data at a constant rate, and storing it at the disc, the scheduler will always be busy.
Comment 3 José JORGE 2016-07-01 14:46:10 UTC
(In reply to Mauro Carvalho Chehab from comment #2)
> When image is paused, there won't be any mpeg decoding. Instead, it will be

Sorry, bad english. I meant most of the frames are lost, so I see only one image every second.
I know CPU usage is not the good indicator, and am also getting terminal info to ensure it works.

For the message "libvdpau_va_gl.so: cannot open shared object file: No such file or directory" I see it when trying to use VDPAU on intel hardware, without the translation layer libvdpau_va_gl.
I just see VAAPI use is not automatic with vlc 2.2.4 : no message if I leave the setting at auto. It works only with --avcodec-hw vaapi parameter :

vlc --avcodec-hw vaapi Vidéos/bbb/bbb_sunflower_1080p_30fps_normal.mp4 
VLC media player 2.2.4 Weatherwax (revision 2.2.3-37-g888b7e89)
[00000000020ee118] core libvlc: Lancement de vlc avec l'interface par défaut. Utilisez « cvlc » pour démarrer VLC sans interface.
[00000000021e8c88] qt4 interface error: Unable to load extensions module
libva info: VA-API version 0.36.0
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_36
libva info: va_openDriver() returns 0
[00007f0c34d222c8] avcodec decoder: Using Intel i965 driver for Intel(R) Haswell Desktop - 1.4.1 for hardware decoding.
Comment 4 Mauro Carvalho Chehab 2016-07-01 15:16:09 UTC
(In reply to José JORGE from comment #3)
> (In reply to Mauro Carvalho Chehab from comment #2)
> > When image is paused, there won't be any mpeg decoding. Instead, it will be
> 
> Sorry, bad english. I meant most of the frames are lost, so I see only one
> image every second.
> I know CPU usage is not the good indicator, and am also getting terminal
> info to ensure it works.
> 
> For the message "libvdpau_va_gl.so: cannot open shared object file: No such
> file or directory" I see it when trying to use VDPAU on intel hardware,
> without the translation layer libvdpau_va_gl.
> I just see VAAPI use is not automatic with vlc 2.2.4 : no message if I leave
> the setting at auto. It works only with --avcodec-hw vaapi parameter :
> 
> vlc --avcodec-hw vaapi Vidéos/bbb/bbb_sunflower_1080p_30fps_normal.mp4 
> VLC media player 2.2.4 Weatherwax (revision 2.2.3-37-g888b7e89)
> [00000000020ee118] core libvlc: Lancement de vlc avec l'interface par
> défaut. Utilisez « cvlc » pour démarrer VLC sans interface.
> [00000000021e8c88] qt4 interface error: Unable to load extensions module
> libva info: VA-API version 0.36.0
> 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_36
> libva info: va_openDriver() returns 0
> [00007f0c34d222c8] avcodec decoder: Using Intel i965 driver for Intel(R)
> Haswell Desktop - 1.4.1 for hardware decoding.

There's a screen at  <Settings> <Configure Kaffeine> <libVLC> that allows you to add extra parameters to libVLC. If you add the parameter there and restart Kaffeine, it will send it to VLC.

That's the output of it, with --debug, with this new option:

01-07-16 12:13:24.562 [Debug   ] src/backend-vlc/vlcmediawidget.cpp#78: bool VlcMediaWidget::init(): Using libVLC with args: --no-video-title-show --avcodec-hw vaapi