[SOLVED] Howto get video hardware acceleration on Intel?

Archived topics about LMDE 1 and LMDE 2
Locked
Hansl
Level 3
Level 3
Posts: 122
Joined: Fri Dec 09, 2011 3:50 pm

[SOLVED] Howto get video hardware acceleration on Intel?

Post by Hansl »

I'm now nearly through setting up LMDE2 Mate on a Lenovo T450s 20BWS33U00 with an i7-5600U and 1920x1080 FHD screen. I have kernel and valib* from jessie-backports.
One thing that doesn't work yet is hardware decoding for VLC and xplayer: playing a FHD video they stutter and need >200 % CPU. Firefox and mpv play with ≈30 % CPU.
Browsing through Arch's wiki prompted me to install i965-va-driver, but it doesn't work:

Code: Select all

  $ inxi -G
Graphics:  Card: Intel Broadwell-U Integrated Graphics
           Display Server: X.Org 1.16.4 drivers: intel (unloaded: fbdev,vesa) Resolution: 1920x1080@60.02hz
           GLX Renderer: Gallium 0.4 on llvmpipe (LLVM 3.5, 256 bits) GLX Version: 3.0 Mesa 10.3.2
 
  $ vainfo 
libva info: VA-API version 0.39.4
libva info: va_getDriverName() returns -1
libva error: va_getDriverName() failed with unknown libva error,driver_name=(null)
vaInitialize failed with error code -1 (unknown libva error),exit

  $ LIBVA_DRIVER_NAME=i965 vainfo
libva info: VA-API version 0.39.4
libva info: va_getDriverName() returns -1
libva info: User requested driver 'i965'
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/i965_drv_video.so
libva info: Found init function __vaDriverInit_0_39
vainfo: intel_driver.c:106: intel_driver_init: Assertion `(((struct drm_state *)(ctx)->drm_state)->auth_type == (VA_DRM_AUTH_DRI1)) || (((struct drm_state *)(ctx)->drm_state)->auth_type == (VA_DRM_AUTH_DRI2)) || (((struct drm_state *)(ctx)->drm_state)->auth_type == (VA_DRM_AUTH_CUSTOM))' failed.
Abgebrochen

  $ mpv http://cdn.c3voc.de/hls/s4_native_hd.m3u8
Playing: http://cdn.c3voc.de/hls/s4_native_hd.m3u8
[ytdl_hook] youtube-dl not found, not executable, or broken. 
[ffmpeg/demuxer] mpegts: DTS discontinuity in stream 0: packet 3 with DTS 1803623671, packet 4 with DTS 1803627270
[ffmpeg/demuxer] mpegts: DTS discontinuity in stream 0: packet 3 with DTS 1803625201, packet 4 with DTS 1803628800
[ffmpeg/demuxer] mpegts: DTS discontinuity in stream 0: packet 3 with DTS 1803742471, packet 4 with DTS 1803760470
[ffmpeg/demuxer] hls,applehttp: DTS discontinuity in stream 4: packet 3 with DTS 1803625201, packet 4 with DTS 1803628800
[ffmpeg/demuxer] hls,applehttp: DTS discontinuity in stream 2: packet 3 with DTS 1803623671, packet 4 with DTS 1803627270
[ffmpeg/demuxer] hls,applehttp: DTS discontinuity in stream 6: packet 3 with DTS 1803742471, packet 4 with DTS 1803760470
 (+) Video --vid=1 'bitrate 5000000' (h264)
     Video --vid=2 'bitrate 800000' (h264)
     Video --vid=3 'bitrate 100000' (h264)
     Audio --aid=1 (aac)
     Audio --aid=2 (aac)
 (+) Audio --aid=3 (*) 'bitrate 5000000' (aac)
     Audio --aid=4 (*) 'bitrate 800000' (aac)
     Audio --aid=5 (*) 'bitrate 100000' (aac)
[vo/opengl] Suspected software renderer or indirect context.
Failed to open VDPAU backend libvdpau_nvidia.so: cannot open shared object file: No such file or directory
[vo/vdpau] Error when calling vdp_device_create_x11: 1
[vo/xv] No Xvideo support found.
libva info: VA-API version 0.39.4
libva info: va_getDriverName() returns -1
libva error: va_getDriverName() failed with unknown libva error,driver_name=(null)
[vaapi] vaInitialize(): unknown libva error
AO: [pulse] 48000Hz mono 1ch float
VO: [x11] 1920x1080 yuv420p
AV: 00:00:03 A-V:  0.000 Cache:  1s+0KB 
What is wrong; what do I need? I've noticed on several LMDE installations that it is a bit of pain to get hw accel to properly work. Recently similarly on an old AMD A450 machine, I finally succeeded but don't recall exactly how…
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 3 times in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
deepakdeshp
Level 20
Level 20
Posts: 12334
Joined: Sun Aug 09, 2015 10:00 am

Re: Howto get VLC hardware acceleration on Intel?

Post by deepakdeshp »

It may be a hardware limitation.
Please paste

Code: Select all

inxi -Fxz
here
If I have helped you solve a problem, please add [SOLVED] to your first post title, it helps other users looking for help.
Regards,
Deepak

Mint 21.1 Cinnamon 64 bit with AMD A6 / 8GB
Mint 21.1 Cinnamon AMD Ryzen3500U/8gb
User avatar
trytip
Level 14
Level 14
Posts: 5371
Joined: Tue Jul 05, 2016 1:20 pm

Re: Howto get VLC hardware acceleration on Intel?

Post by trytip »

you can test hardware only in VLC>tools>preferences>video>output and play with each video output but VLC and MPV usually picks the best way for hardware decoding (you need to restart VLC each time you select a different output) there is also a selection under Input/Codecs under hardware accelerated. only test one change at a time in output first then the codecs

have you installed any drivers in driver manager?
Image
Hansl
Level 3
Level 3
Posts: 122
Joined: Fri Dec 09, 2011 3:50 pm

Re: Howto get VLC hardware acceleration on Intel?

Post by Hansl »

Code: Select all

 $ inxi -Fxz
System:    Host: hpl13 Kernel: 4.9.0-0.bpo.4-amd64 x86_64 (64 bit gcc: 4.9.2) Desktop: MATE 1.18.0 (Gtk 3.14.5+4) 
           Distro: LinuxMint 2 betsy 
Machine:   System: LENOVO product: 20BWS33U00 v: ThinkPad T450s
           Mobo: LENOVO model: 20BWS33U00 v: SDK0E50510 WIN Bios: LENOVO v: JBET66WW (1.30 ) date: 09/13/2017
CPU:       Dual core Intel Core i7-5600U (-HT-MCP-) cache: 4096 KB
           flags: (lm nx sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx) bmips: 10376 
           Clock Speeds: 1: 2346 MHz 2: 1929 MHz 3: 1065 MHz 4: 1044 MHz
Graphics:  Card: Intel Broadwell-U Integrated Graphics bus-ID: 00:02.0
           Display Server: X.Org 1.16.4 drivers: intel (unloaded: fbdev,vesa) Resolution: 1920x1080@60.02hz
           GLX Renderer: Gallium 0.4 on llvmpipe (LLVM 3.5, 256 bits)
           GLX Version: 3.0 Mesa 10.3.2 Direct Rendering: Yes
Audio:     Card-1 Intel Wildcat Point-LP High Definition Audio Controller driver: snd_hda_intel bus-ID: 00:1b.0 
           Card-2 Intel Broadwell-U Audio Controller driver: snd_hda_intel bus-ID: 00:03.0 
           Sound: Advanced Linux Sound Architecture v: k4.9.0-0.bpo.4-amd64
Network:   Card-1: Intel Wireless 7265 driver: iwlwifi bus-ID: 03:00.0
           IF: wlan0 state: up mac: <filter>
           Card-2: Intel Ethernet Connection (3) I218-LM driver: e1000e v: 3.2.6-k port: 3080 bus-ID: 00:19.0
           IF: eth0 state: down mac: <filter>
Drives:    HDD Total Size: 256.1GB (13.2% used) ID-1: /dev/sda model: SAMSUNG_MZ7LN256 size: 256.1GB
Partition: ID-1: / size: 63G used: 8.0G (14%) fs: ext4 dev: /dev/dm-2 
           ID-2: /home size: 156G used: 8.3G (6%) fs: ext4 dev: /dev/dm-3 
           ID-3: swap-1 size: 17.18GB used: 0.01GB (0%) fs: swap dev: /dev/dm-1 
Sensors:   System Temperatures: cpu: 42.0C mobo: N/A 
           Fan Speeds (in rpm): cpu: 0 
Info:      Processes: 207 Uptime: 4 days Memory: 2150.0/11739.9MB Init: SysVinit runlevel: 2 Gcc sys: 4.9.2 
           Client: Shell (bash 4.3.301) inxi: 2.1.28 
How much CPU load is to be expected with working HW accel at FHD playback? Quite less than 10 %, I think?
Hansl
Level 3
Level 3
Posts: 122
Joined: Fri Dec 09, 2011 3:50 pm

Re: Howto get VLC hardware acceleration on Intel?

Post by Hansl »

I have installed mint-meta-codecs / mint-meta-debian-codecs and i965-va-driver.
User avatar
trytip
Level 14
Level 14
Posts: 5371
Joined: Tue Jul 05, 2016 1:20 pm

Re: Howto get VLC hardware acceleration on Intel?

Post by trytip »

those are codecs not drivers. is there a driver manager in LMDE, open that.

i use nvidia 9800GT and vdpau with a pretty old computer from 2007 and i get about 3-5% cpu on a very HD avatar movie but it also depends if the video is x265 or h264
Image
Hansl
Level 3
Level 3
Posts: 122
Joined: Fri Dec 09, 2011 3:50 pm

Re: Howto get VLC hardware acceleration on Intel?

Post by Hansl »

Afaik, in LMDE2 there is no Driver Manager like in Ubuntu-based Mint. i965-va-drive is the GPU driver:

Code: Select all

  $ apt show i965-va-driver
[…] 
Description: VAAPI driver for Intel G45 & HD Graphics family
 The VA-API (Video Acceleration API) enables hardware accelerated video
 decode/encode at various entry-points (VLD, IDCT, Motion Compensation etc.) for
 the prevailing coding standards today (MPEG-2, MPEG-4 ASP/H.263, MPEG-4
 AVC/H.264, and VC-1/WMV3). It provides an interface to fully expose the video
 decode capabilities in today's GPUs. 
[…] 
But it does not quite work or is not recognized, see vainfo outputs in my initial post; vlc -v prints the same error »va_getDriverName() returns -1«, mpv too. Why?? There seems to be a bug with libva1 not working with Wayland, giving this error, but LMDE2 still uses X, not Wayland, right?
User avatar
trytip
Level 14
Level 14
Posts: 5371
Joined: Tue Jul 05, 2016 1:20 pm

Re: Howto get VLC hardware acceleration on Intel?

Post by trytip »

try to use this : create a blank text file and name it mpv.conf copy this code:

Code: Select all

#
###########
# General #
###########
#
geometry=50%:50%
autofit-larger=100%x95%
cursor-autohide=4500
osd-duration=4500
save-position-on-quit
#
################
# Video Output #
################
#
hwdec=vaapi
hwdec-codecs=all
video-output-levels=full
#
#########
# Audio #
#########
#
volume-max=200
volume=100
#
#########
# Cache #
#########
#
cache=no
cache-default=5000000
cache-backbuffer=25000
cache-initial=0
cache-secs=10
#
now take this and move it to .config/mpv (create a folder called mpv if you don't have one)
this should enable vappi in mpv
so in the end you will now have .config/mpv/mpv.conf
source https://www.dotslashlinux.com/2017/03/3 ... iguration/ took me quite a while to understand mpv.conf and the code here's a simplified i use only i swapped vdpau for vaapi
Image
Hansl
Level 3
Level 3
Posts: 122
Joined: Fri Dec 09, 2011 3:50 pm

Re: Howto get video hardware acceleration on Intel?

Post by Hansl »

trytip, thank you, I tried this mpv.conf, but it does not work. Same error, from mpv's stderr:
libva info: VA-API version 0.39.4
libva info: va_getDriverName() returns -1
libva error: va_getDriverName() failed with unknown libva error,driver_name=(null)
[vaapi] vaInitialize(): unknown libva error
VO does not support requested hardware decoder.
Using software decoding.
Also tried diverse manual settings in VLC — either ran as before, or crashed in some way or other.
Obviously the problem is not with VLC or MPV, but the non-working GPU driver. (Changed the thread title accordingly.)
User avatar
trytip
Level 14
Level 14
Posts: 5371
Joined: Tue Jul 05, 2016 1:20 pm

Re: Howto get video hardware acceleration on Intel?

Post by trytip »

maybe someone with intel on LMDE can be more helpful otherwise you can try some debian fixes http://www.ismoothblog.com/2016/12/inst ... ation.html i believe LMDE is based on Jessie?
Image
User avatar
Pjotr
Level 23
Level 23
Posts: 19885
Joined: Mon Mar 07, 2011 10:18 am
Location: The Netherlands (Holland) 🇳🇱
Contact:

Re: Howto get video hardware acceleration on Intel?

Post by Pjotr »

You might try a driver change, like this:
https://sites.google.com/site/easylinux ... l-graphics
(item 6, left column)

Don't forget to do the compatibility check described in that how-to, before you proceed.
Tip: 10 things to do after installing Linux Mint 21.3 Virginia
Keep your Linux Mint healthy: Avoid these 10 fatal mistakes
Twitter: twitter.com/easylinuxtips
All in all, horse sense simply makes sense.
Hansl
Level 3
Level 3
Posts: 122
Joined: Fri Dec 09, 2011 3:50 pm

[SOLVED] Re: Howto get video hardware acceleration on Intel?

Post by Hansl »

YESSS!  Trytip, your last link showed me the light:  I had kernel and some drivers from backports, but then xserver-xorg-video-intel must be from backports, too!  This solved the vainfo error, now MPV ran with HW accel. (The hwdec=vaapi entry in mpv.conf is needed, too.)  For VLC libvdpau-va-gl1 from backports was additionally needed, and setting its Inputs/Codecs to VA-API over X11.  libvdpau1, i965-va-driver and libva1 were already from backports.

Now VLC, MPV run smoothly with <10 % CPU. XPlayer not, but it is not so important to me.

Then I tried Pjotrs tip, namely removing xserver-xorg-video-intel (and i965-va-driver) completely.  Unfortunately this did not work out, inxi -G listed no driver at all, huh?  And VLC and MPV fell back to software decoding.  So I reinstalled both again, good again.  Works for me, so I'm calling it Solved.

Thank you all very much, and have a Happy New Year!  I have it now: :D
User avatar
trytip
Level 14
Level 14
Posts: 5371
Joined: Tue Jul 05, 2016 1:20 pm

Re: [SOLVED] Howto get video hardware acceleration on Intel?

Post by trytip »

here's a good toy to play with in mpv it's a volume compressor that will normalize sound in low audio movies. there are many scripts like this, for now i just use this one. it requires ffmpeg to be installed also create a new folder named scripts .config/mpv/scripts/ in that folder create a blank text named acompressor.lua and paste this code in it.

Code: Select all

-- This script adds control to the dynamic range compression ffmpeg
-- filter including key bindings for adjusting parameters.
--
-- See https://ffmpeg.org/ffmpeg-filters.html#acompressor for explanation
-- of the parameteres.

local mp = require 'mp'
local options = require 'mp.options'

local o = {
	default_enable = false,
	show_osd = true,
	osd_timeout = 4000,
	filter_label = mp.get_script_name(),

	key_toggle = 'n',
	key_increase_threshold = 'F1',
	key_decrease_threshold = 'Shift+F1',
	key_increase_ratio = 'F2',
	key_decrease_ratio = 'Shift+F2',
	key_increase_knee = 'F3',
	key_decrease_knee = 'Shift+F3',
	key_increase_makeup = 'F4',
	key_decrease_makeup = 'Shift+F4',
	key_increase_attack = 'F5',
	key_decrease_attack = 'Shift+F5',
	key_increase_release = 'F6',
	key_decrease_release = 'Shift+F6',

	default_threshold = -25.0,
	default_ratio = 3.0,
	default_knee = 2.0,
	default_makeup = 8.0,
	default_attack = 20.0,
	default_release = 250.0,

	step_threshold = -2.5,
	step_ratio = 1.0,
	step_knee = 1.0,
	step_makeup = 1.0,
	step_attack = 10.0,
	step_release = 10.0,
}
options.read_options(o)

local params = {
	{ name = 'attack',    min=0.01, max=2000, hide_default=true,  dB=''   },
	{ name = 'release',   min=0.01, max=9000, hide_default=true,  dB=''   },
	{ name = 'threshold', min= -30, max=   0, hide_default=false, dB='dB' },
	{ name = 'ratio',     min=   1, max=  20, hide_default=false, dB=''   },
	{ name = 'knee',      min=   1, max=  10, hide_default=true,  dB='dB' },
	{ name = 'makeup',    min=   0, max=  24, hide_default=false, dB='dB' },
}

local function parse_value(value)
	-- Using nil here because tonumber differs between lua 5.1 and 5.2 when parsing fractions in combination with explicit base argument set to 10.
	-- And we can't omit it because gsub returns 2 values which would get unpacked and cause more problems. Gotta love scripting languages.
	return tonumber(value:gsub('dB$', ''), nil)
end

local function format_value(value, dB)
	return string.format('%g%s', value, dB)
end

local function show_osd(filter)
	if not o.show_osd then
		return
	end

	if not filter.enabled then
		mp.commandv('show-text', 'Dynamic range compressor: disabled', o.osd_timeout)
		return
	end

	local pretty = {}
	for _,param in ipairs(params) do
		local value = parse_value(filter.params[param.name])
		if not (param.hide_default and value == o['default_' .. param.name]) then
			pretty[#pretty+1] = string.format('%s: %g%s', param.name:gsub("^%l", string.upper), value, param.dB)
		end
	end

	if #pretty == 0 then
		pretty = ''
	else
		pretty = '\n(' .. table.concat(pretty, ', ') .. ')'
	end

	mp.commandv('show-text', 'Dynamic range compressor: enabled' .. pretty, o.osd_timeout)
end

local function get_filter()
	local af = mp.get_property_native('af', {})

	for i = 1, #af do
		if af[i].label == o.filter_label then
			return af, i
		end
	end

	af[#af+1] = {
		name = 'acompressor',
		label = o.filter_label,
		enabled = false,
		params = {},
	}

	for _,param in pairs(params) do
		af[#af].params[param.name] = format_value(o['default_' .. param.name], param.dB)
	end

	return af, #af
end

local function toggle_acompressor()
	local af, i = get_filter()
	af[i].enabled = not af[i].enabled
	mp.set_property_native('af', af)
	show_osd(af[i])
end

local function update_param(name, increment)
	for _,param in pairs(params) do
		if param.name == string.lower(name) then
			local af, i = get_filter()
			local value = parse_value(af[i].params[param.name])
			value = math.max(param.min, math.min(value + increment, param.max))
			af[i].params[param.name] = format_value(value, param.dB)
			af[i].enabled = true
			mp.set_property_native('af', af)
			show_osd(af[i])
			return
		end
	end

	mp.msg.error('Unknown parameter "' .. name .. '"')
end

mp.add_key_binding(o.key_toggle, "toggle-acompressor", toggle_acompressor)
mp.register_script_message('update-param', update_param)

for _,param in pairs(params) do
	for direction,step in pairs({increase=1, decrease=-1}) do
		mp.add_key_binding(o['key_' .. direction .. '_' .. param.name],
		                   'acompressor-' .. direction .. '-' .. param.name,
		                   function() update_param(param.name, step*o['step_' .. param.name]); end,
		                   { repeatable = true })
	end
end

if o.default_enable then
	local af, i = get_filter()
	af[i].enabled = true
	mp.set_property_native('af', af)
end
start a video and press the "n" key and you turn on the compressor. press the "n" key and it will go off.
here are more scripts for mpv https://github.com/mpv-player/mpv/wiki/User-Scripts
Image
Locked

Return to “LMDE Archive”