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:
I tried the acceleration in vlc (automatic mode for acceleration) but it's still choppy:
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:
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: . As you can read:
avcodec decoder warning: threaded frame decoding is not compatible with avcodec-hw, disabledAlso:
avcodec decoder debug: using slice thread mode with 4 threadsI only see 25% CPU usage while mplayer does 100%. In any case, hardware doesn't seem to be used (even with mplayer).
15 Answers
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):
8Is 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.
1I'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 ofThreadsfrom0(auto) to1.
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.
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! :)
1I have solved this issue by disabling video quality post-processing level.
So to disable this option -
Open vlc đź ’ Tools đź ’ Preferences đź ’ Input/Codecs.
and now set video quality post-processing level to 0 (the default is 6; 0 means disabled).