7

I'm trying to run a 4k h264 MPEG4-AVC part 10, 4k 3840x2160 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).

  • Just so we have a little more to work with: what is the output of "cat /proc/cpuinfo | grep CPU" and "lspci | grep VGA"? – G Trawo Dec 7 '15 at 20:07
7

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

  • Thanks! I have edited the question to go one step beyond. – gregoiregentil Dec 7 '15 at 21:23
  • What was the output when you ran the vlc command from the command line? Also, what does 'vainfo' output? – G Trawo Dec 8 '15 at 1:49
  • I moved ' vdpau-va-driver' to the intel part of the packages. Try installing that package and change the hardware-accelerated decoding to 'VA-API video decoder via X11'. – G Trawo Dec 8 '15 at 3:44
  • I have edited the question a second time with more info. – gregoiregentil Dec 8 '15 at 6:09
  • There is a newer version of VLC you may require to play back 4k, but 14.04 only goes to 2.1. For you to get 2.2 you will have to install this PPA: 'ppa:mc3man/trusty-media' . Be mindful that that PPA will cause issues when you upgrade your LTS version. Always do a purge first. – G Trawo Dec 8 '15 at 15:12
2

Is there a fix?

Answer to the question: it depends.

I think there are some other questions you have to ask in order to solve your problem of not being able to play 4K video without it being "choppy" using vlc:

  • What videocard (GPU) do you have?
  • Do you have the correct driver installed?
  • are these drivers being used?
  • Is mplayer using hardware acceleration?
  • Is VLC using hardware acceleration?
    • if yes: why is it not playing smoothly?
    • what codec do you need?
    • etc.

Hint

From your findings I guess mplayer is using hardware acceleration, since I don't know a CPU that can playback 4K video, so I guess that you probably have a GPU that is good enough to playback 4K.

  • Thanks! I have edited the question to go one step beyond. – gregoiregentil Dec 7 '15 at 21:24
0

I've came across 3 issues to get hardware acceleration working on VLC on Ubuntu 16.04.

Long and detailed answer here: How to enable Hardware acceleration

  • For NVIDIA video cards, you need to switch to the NVIDIA proprietary drivers version R367+
  • There are bugs in VLC 2.2: upgrade to at least VLC 2.2.4, or ideally nightly VLC 3.0 from VLC official PPA ppa:videolan/master-daily.
  • If you are using VLC with FFmpeg (that's by default I think), you must disable FFmpeg multithreading in VLC > Tools > Preferences (All) > Input / Codecs > Video codecs > FFmpeg: change the value of Threads from 0 (auto) to 1.

Of course, you must enable hardware acceleration in VLC > Tools > Preferences (Simple) > Input / Codecs > Hardware-acceleration decoding = Auto. For NVIDIA, you can choose VDPAU video decoder explicitely.

Note that for NVIDIA, HEVC (H265) Profile Main 10 is currently not supported by the Linux driver. Check the NVIDIA final software+hardware support using vdpauinfo.

  • I got version 2.2.4, I still got a laggy/sloopy video. Despite the settings of the threads and decoding on VDPAU (I have also nvidia driver, with proprietary driver). VLC is just not working! Too bad since I use VLC for all movies, but 4K is just not working. Mplayer is. – danger89 Jan 19 '17 at 20:44
0

VLC worked for my DJI phantom3 pro, 4k video.

Launch VLC Player > Tools > Preferences > Input/Codecs > Hardware-accelerated decoding -> select from dropdown "DirectX Video Acceleration" (DXVA) 2.0.

It worked for me right away! :)

  • Which Ubuntu version do you have? – gregoiregentil Jul 1 '17 at 19:16

Your Answer

By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.