Ubuntu – vlc 4k choppy while mplayer is smooth

mplayervideo playervlc

I'm trying to run a 4k h264 MPEG4-AVC part 10, 4k 3840×2160 video. It's totally choppy on VLC (2.1.6 Rincewind) which seems to use only one CPU. The video is perfectly smooth on mplayer which seems to use more than one CPU. My laptop is not super recent but it's still a powerful 2.5GHz i7 Samsung device. Is there a fix?

EDIT #1

DPKG info:

dpkg -l | grep libva
ii  libva-dev:amd64                                             1.3.0-2                                             amd64        Video Acceleration (VA) API for Linux -- development files
ii  libva-drm1:amd64                                            1.3.0-2                                             amd64        Video Acceleration (VA) API for Linux -- DRM runtime
ii  libva-egl1:amd64                                            1.3.0-2                                             amd64        Video Acceleration (VA) API for Linux -- EGL runtime
ii  libva-glx1:amd64                                            1.3.0-2                                             amd64        Video Acceleration (VA) API for Linux -- GLX runtime
ii  libva-tpi1:amd64                                            1.3.0-2                                             amd64        Video Acceleration (VA) API for Linux -- TPI runtime
ii  libva-wayland1:amd64                                        1.3.0-2                                             amd64        Video Acceleration (VA) API for Linux -- Wayland runtime
ii  libva-x11-1:amd64                                           1.3.0-2                                             amd64        Video Acceleration (VA) API for Linux -- X11 runtime
ii  libva1:amd64                                                1.3.0-2                                             amd64        Video Acceleration (VA) API for Linux -- runtime
ii  libvamp-hostsdk3:amd64                                      2.5+repack0-2                                       amd64        helper library for Vamp hosts written in C++

LSPCI info:

lspci | grep VGA
00:02.0 VGA compatible controller: Intel Corporation 3rd Gen Core processor Graphics Controller (rev 09)

CPU info:
cat /proc/cpuinfo | grep CPU
model name : Intel(R) Core(TM) i7-3537U CPU @ 2.00GHz
model name : Intel(R) Core(TM) i7-3537U CPU @ 2.00GHz
model name : Intel(R) Core(TM) i7-3537U CPU @ 2.00GHz
model name : Intel(R) Core(TM) i7-3537U CPU @ 2.00GHz

mplayer seems to use 3 CPU as I'm at 75% in CPU monitor. Here is the log: http://pastebin.com/65Uuk3An

I tried the acceleration in vlc (automatic mode for acceleration) but it's still choppy: http://pastebin.com/F8TZXxnG

EDIT #2

vainfo was returning an error. I have just installed i965-va-driver, vdpau-va-driver, libvdpau-va-gl1 on my Ubuntu 14.04. vainfo now returns: http://pastebin.com/r0DcMMUg

Mplayer nows takes 100% CPU (all cores).

VLC is still choppy though it now finds va_openDriver and doesn't report an error like in my edit #1. Also, note that VLC never returns and I have to kill -9 it. It has always been the case when decoding a 4k file.

Edit #3

Here is a more verbose debug of vlc: http://pastebin.com/8ykvG9rc. As you can read:

avcodec decoder warning: threaded frame decoding is not compatible with avcodec-hw, disabled

Also:

avcodec decoder debug: using slice thread mode with 4 threads

I only see 25% CPU usage while mplayer does 100%. In any case, hardware doesn't seem to be used (even with mplayer).

Best Answer

Chances are you can offload the video playback onto the video card, instead of using the CPU(s).

Make sure you have the vaapi packages installed (for Intel/AMD video card):

sudo apt-get install libva1 libva-x11-1 vainfo vdpau-va-driver

If you have an Nvidia card add this:

sudo apt-get install vdpauinfo libvdpau

Since mplayer is working fine, it may already be using hardware acceleration. So these packages may already be installed.

Next, see if VLC will start with hardware acceleration:

vlc -v /path/to/name-of-file

There also is an option in the GUI to turn on hardware acceleration. Check to see what it is set on (Tools>Preferences>Input/Codec):

VLC Options