You are not logged in.

#1 2021-06-19 05:41:53

farmerdave
Member
Registered: 2011-11-23
Posts: 114

[SOLVED] Kodi 19.1 Matrix high cpu and stuttering playback

Hi, I have recently upgraded my old HTPC from kodi 18.9 to Kodi 19.1 and cannot get the same smooth video playback. 18.9 ran great on my old hardware, smooth 1080p playback and low cpu.

Now videos show stuttering, especially 1080p but sometimes 720p too and cpu is usually around 90%.

I updated a lot of packages that day, including
ffmpeg from 2:4.3.1-4 -> 2:4.4-3
kodi from 18.9-3 -> 19.1-1

I posted in the Kodi forum but was immediately directed here. A debug log is here: https://pastebin.com/F6ACAL3W

CPU is AMD 4850e (old, I know)
GPU is NVidia GT1030
(I acutally used to use an older GT430 with the nvidia 390xx driver, worked perfectly on kodi 18.9, but I swapped to the GT1030 thinking it might solve the problem)

Currently using
libvdpau 1.4-1
nvidia-dkms 465.31-1
nvidia-utils 465.31-1

kernel versions: 5.12.11 and 5.10.44-lts

I've tried options in the advancedsettings.xml but no difference.
I also tried removing the databases and re-importing library, and even went as far as deleting the entire ~/.kodi directory and reinstalling kodi but no change.

I can play the exact same video (1920x1080 x264 video) with VLC and MPV and have perfect playback, smooth and low cpu (about 5-6%)
e.g. if I use "$ mpv --hwdec=auto ~/1080p_video_file.mkv" the driver is reported to be cuda and playback is good

In Kodi there are no options for me to choose hardware acceleration. How can I force Kodi to use the driver I want it to, is there an environment variable I can set?

Last edited by farmerdave (2021-06-21 10:11:14)

Offline

#2 2021-06-19 22:06:23

Mischa85
Member
Registered: 2020-12-06
Posts: 17

Re: [SOLVED] Kodi 19.1 Matrix high cpu and stuttering playback

Same problem here. Lost all hardware decoding and deinterlacing.

What I can make out is that even kodi-git compiled with -DENABLE_VDPAU=ON does not seem to use VDPAU at all. I'm also unable to produce relevant debug logging...

There were rumors of VDPAU removal in Kodi 19, but I cannot make out if this actually happened. If they did, and continue to refuse to support NVDEC, they are really leaving NVIDIA users in the dust...

Last edited by Mischa85 (2021-06-19 22:07:08)

Offline

#3 2021-06-19 23:58:50

farmerdave
Member
Registered: 2011-11-23
Posts: 114

Re: [SOLVED] Kodi 19.1 Matrix high cpu and stuttering playback

Mischa85 wrote:

Same problem here. Lost all hardware decoding and deinterlacing.

What I can make out is that even kodi-git compiled with -DENABLE_VDPAU=ON does not seem to use VDPAU at all. I'm also unable to produce relevant debug logging...

There were rumors of VDPAU removal in Kodi 19, but I cannot make out if this actually happened. If they did, and continue to refuse to support NVDEC, they are really leaving NVIDIA users in the dust...

Good to know I'm not alone here, been reading wiki's and forums for days now!
If I press 'o' while watching a video I get

Video Decoder: ff-h264 (SW)
pxel format: yuv420p

The arch wiki in this section (https://wiki.archlinux.org/title/Kodi#H … ingle_core) says

...go to System Settings > Video. Set the settings level to Advanced or Expert. Then go to Acceleration and set Decoding method to software

but that section does not exist for me, so I cannot choose between hardware and software.

Using the examples on https://wiki.archlinux.org/title/Hardwa … celeration, both vaapi and vdpau are working (according to vainfo and vdpauinfo). Using https://wiki.archlinux.org/title/Hardwa … rification example

$ mpv --hwdec=auto video_filename
(+) Video --vid=1 (*) (h264 1920x808 23.976fps)
 (+) Audio --aid=1 --alang=eng (*) (dts 6ch 48000Hz)
 (+) Subs  --sid=1 --slang=eng (*) (subrip)
Using hardware decoding (nvdec).
AO: [pulse] 48000Hz 5.1(side) 6ch float
VO: [gpu] 1920x808 cuda[nv12]
AV: 00:00:02 / 02:28:06 (0%) A-V:  0.000 Cache: 193s/129MB

but changing it to hwdec=vdpau plays poorly and high cpu

$ mpv --hwdec=vdpau video_filename
 (+) Video --vid=1 (*) (h264 1920x808 23.976fps)
 (+) Audio --aid=1 --alang=eng (*) (dts 6ch 48000Hz)
 (+) Subs  --sid=1 --slang=eng (*) (subrip)
AO: [pulse] 48000Hz 5.1(side) 6ch float
VO: [gpu] 1920x808 yuv420p
AV: 00:00:06 / 02:28:06 (0%) A-V:  0.000 Cache: 232s/150MB

If I could just find a flag or environment variable to set when starting Kodi to use nvdec I would be happy! Or is there a setting in advancedsettings.xml I could use? (I already tried "vdpauscaling" both true and false) If I need to recompile kodi, I can do that too, just need to know what to set.

Offline

#4 2021-06-21 10:09:50

farmerdave
Member
Registered: 2011-11-23
Posts: 114

Re: [SOLVED] Kodi 19.1 Matrix high cpu and stuttering playback

I compiled the kodi packages myself, doing nothing except clone the svntogit-community repo and commenting out the GBD and wayland builds as I only needed x11. I did a makepkg and then replaced kodi-common and kodi-x11 packages on my system with the ones compiled locally. Now a new option appears in the Kodi Settings, which was not there before when using the distribution package:
https://i.imgur.com/i0idibX.png
and HW acceleration appears to be working fine again!

Mod Edit - Replaced oversized image with link.
CoC - Pasting pictures and code

Last edited by Slithery (2021-06-28 18:33:35)

Offline

#5 2021-06-28 02:08:39

dafrizz
Member
Registered: 2011-05-27
Posts: 31

Re: [SOLVED] Kodi 19.1 Matrix high cpu and stuttering playback

Are you able to run through the steps for this ?

I did the following:

svn checkout --depth=empty svn://svn.archlinux.org/community

which created a directory community

I then ran

svn update kodi-common

which returned

At revision 967647

but did not create any files. What am I missing ?

Thank you.

Offline

#6 2021-06-28 11:15:46

dafrizz
Member
Registered: 2011-05-27
Posts: 31

Re: [SOLVED] Kodi 19.1 Matrix high cpu and stuttering playback

I am getting closer.

I ran

svn update kodi

Updating 'kodi':
A    kodi
A    kodi/repos
A    kodi/repos/community-x86_64
A    kodi/repos/community-x86_64/0001-allow-separate-windowing-binaries-being-launched-fro.patch
A    kodi/repos/community-x86_64/10160.patch
A    kodi/repos/community-x86_64/10775.patch
A    kodi/repos/community-x86_64/17804.patch
A    kodi/repos/community-x86_64/18131.patch
A    kodi/repos/community-x86_64/9703.patch
A    kodi/repos/community-x86_64/PKGBUILD
A    kodi/repos/community-x86_64/cheat-sse-build.patch
A    kodi/repos/community-x86_64/cpuinfo
A    kodi/repos/community-x86_64/fix-ftpparse.patch
A    kodi/repos/community-x86_64/fix-python-lib-path.patch
A    kodi/trunk
A    kodi/trunk/PKGBUILD
A    kodi/trunk/0001-allow-separate-windowing-binaries-being-launched-fro.patch
A    kodi/trunk/cheat-sse-build.patch
A    kodi/trunk/18131.patch
A    kodi/trunk/17804.patch
A    kodi/trunk/cpuinfo
A    kodi/trunk/fix-ftpparse.patch
A    kodi/trunk/fix-python-lib-path.patch
A    kodi/trunk/10775.patch
A    kodi/trunk/10160.patch
A    kodi/trunk/9703.patch
Updated to revision 967686.

Which created the structure etc.

However if I then start makepkg I get this

makepkg
==> Making package: kodi 19.1-1 (Mon Jun 28 20:41:14 2021)
==> Checking runtime dependencies...
==> Checking buildtime dependencies...
==> Retrieving sources...
  -> Downloading kodi-19.1-Matrix.tar.gz...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- -  0     0    0     0    0     0      0      0 --:--:-- -100   126  100   126    0     0    289      0 --:--:-- --:--:-- --:--:--   289
  0    14    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
curl: (22) The requested URL returned error: 404
==> ERROR: Failure while downloading https://github.com/xbmc/xbmc/archive/refs/tags/v19.1.tar.gz
    Aborting...

Offline

#7 2021-06-28 18:22:39

Greg0
Member
Registered: 2021-06-28
Posts: 3

Re: [SOLVED] Kodi 19.1 Matrix high cpu and stuttering playback

farmerdave wrote:

I compiled the kodi packages myself
...
and HW acceleration appears to be working fine again!

Thanks, fixed for me too! Wondering why it broke in the first place, the only thing I can see is that the order was changed since 19.0-9 so x11 is now compiled last instead of first:
https://github.com/archlinux/svntogit-c … 5eb9b7203a

dafrizz wrote:

I am getting closer.
However if I then start makepkg I get this

You'll need to tweak the PKGBUILD, see:
https://bugs.archlinux.org/task/71222
And depending on your Java version:
https://github.com/xbmc/xbmc/pull/19885

Offline

#8 2021-06-30 12:07:53

dafrizz
Member
Registered: 2011-05-27
Posts: 31

Re: [SOLVED] Kodi 19.1 Matrix high cpu and stuttering playback

Getting closer, but I am having trouble getting past the java issue.

I applied these two changes to my CMakeLists.txt:
https://github.com/wsnipex/xbmc/commit/ … 302623509d
https://github.com/xbmc/xbmc/pull/19891/files

and my CMakeLists.txt now looks like this:

function(generate_file file)
  set(classpath ${GROOVY_DIR}/groovy-all-${GROOVY_VER}.jar
                ${GROOVY_DIR}/commons-lang-${COMMONS_VER}.jar
                ${CMAKE_SOURCE_DIR}/tools/codegenerator
                ${CMAKE_CURRENT_SOURCE_DIR}/../python)
  if(NOT CORE_SYSTEM_NAME STREQUAL windows AND NOT CORE_SYSTEM_NAME STREQUAL windowsstore)
    set(devnull "/dev/null")
    string(REPLACE ";" ":" classpath "${classpath}")
  else()
    set(devnull "nul")
  endif()

  set(CPP_FILE ${file}.cpp)
  if(CLANGFORMAT_FOUND)
    set(CLANG_FORMAT_COMMAND COMMAND ${CLANG_FORMAT_EXECUTABLE} ARGS -i ${CPP_FILE})
  endif()
  
  if(Java_VERSION_MAJOR GREATER 8)
    set(JAVA_OPEN_OPTS --add-opens java.base/java.util=ALL-UNNAMED --add-opens java.base/java.util.regex=ALL-UNNAMED --add-opens java.base/java.io=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED  --add-opens java.base/java.net=ALL-UNNAMED)
  endif()

  add_custom_command(OUTPUT ${CPP_FILE}
                     COMMAND ${SWIG_EXECUTABLE}
                     ARGS -w401 -c++ -o ${file}.xml -xml -I${CMAKE_SOURCE_DIR}/xbmc -xmllang python ${CMAKE_CURRENT_SOURCE_DIR}/../swig/${file}
                     COMMAND ${Java_JAVA_EXECUTABLE}
                     ARGS ${JAVA_OPEN_OPTS} -cp "${classpath}" groovy.ui.GroovyMain ${CMAKE_SOURCE_DIR}/tools/codegenerator/Generator.groovy ${file}.xml ${CMAKE_CURRENT_SOURCE_DIR}/../python/PythonSwig.cpp.template ${file}.cpp > ${devnull}
                     ${CLANG_FORMAT_COMMAND}
                     DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/../swig/${file} ${CMAKE_CURRENT_SOURCE_DIR}/../python/PythonSwig.cpp.template)
  set(SOURCES ${SOURCES} "${CPP_FILE}" PARENT_SCOPE)
endfunction()

find_package(Java COMPONENTS Runtime REQUIRED)
find_package(SWIG REQUIRED)

# The generated bindings
set(INPUTS AddonModuleXbmcaddon.i
           AddonModuleXbmcdrm.i
           AddonModuleXbmcgui.i
           AddonModuleXbmc.i
           AddonModuleXbmcplugin.i
           AddonModuleXbmcvfs.i
           AddonModuleXbmcwsgi.i)

set(GROOVY_DIR ${CMAKE_SOURCE_DIR}/tools/codegenerator/groovy)
set(GROOVY_VER 2.4.4)
set(COMMONS_VER 2.6)

foreach(INPUT IN LISTS INPUTS)
  generate_file(${INPUT})
  list(APPEND GEN_SRCS ${CMAKE_CURRENT_BINARY_DIR}/${INPUT}.cpp)
endforeach()

add_library(python_binding STATIC ${SOURCES})
set_target_properties(python_binding PROPERTIES POSITION_INDEPENDENT_CODE TRUE
                                                FOLDER "Build Utilities")
set(core_DEPENDS python_binding ${core_DEPENDS} CACHE STRING "" FORCE)
add_dependencies(python_binding ${GLOBAL_TARGET_DEPS})

if(CORE_SYSTEM_NAME STREQUAL windowsstore)
  set_target_properties(python_binding PROPERTIES STATIC_LIBRARY_FLAGS "/ignore:4264")
endif()

but when I run makepkg I get the following:

Generating AddonModuleXbmcwsgi.i.cpp
Caught: java.lang.reflect.InaccessibleObjectException: Unable to make field protected transient int java.util.AbstractList.modCount accessible: module java.base does not "opens java.util" to unnamed module @1b68ddbd
java.lang.reflect.InaccessibleObjectException: Unable to make field protected transient int java.util.AbstractList.modCount accessible: module java.base does not "opens java.util" to unnamed module @1b68ddbd
	at Generator$_run_closure1.doCall(Generator.groovy:43)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:78)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at Generator.run(Generator.groovy:39)
make[2]: *** [build/swig/CMakeFiles/python_binding.dir/build.make:112: build/swig/AddonModuleXbmcwsgi.i.cpp] Error 1
make[1]: *** [CMakeFiles/Makefile2:10815: build/swig/CMakeFiles/python_binding.dir/all] Error 2
make: *** [Makefile:146: all] Error 2
==> ERROR: A failure occurred in build().
    Aborting...

Not sure what I am doing wrong. Thank you.

Offline

#9 2021-06-30 13:55:06

Greg0
Member
Registered: 2021-06-28
Posts: 3

Re: [SOLVED] Kodi 19.1 Matrix high cpu and stuttering playback

dafrizz wrote:

but when I run makepkg I get the following:

Generating AddonModuleXbmcwsgi.i.cpp
Caught: java.lang.reflect.InaccessibleObjectException: Unable to make field protected transient int java.util.AbstractList.modCount accessible: module java.base does not "opens java.util" to unnamed module @1b68ddbd
java.lang.reflect.InaccessibleObjectException: Unable to make field protected transient int java.util.AbstractList.modCount accessible: module java.base does not "opens java.util" to unnamed module @1b68ddbd
	at Generator$_run_closure1.doCall(Generator.groovy:43)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:78)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at Generator.run(Generator.groovy:39)
make[2]: *** [build/swig/CMakeFiles/python_binding.dir/build.make:112: build/swig/AddonModuleXbmcwsgi.i.cpp] Error 1
make[1]: *** [CMakeFiles/Makefile2:10815: build/swig/CMakeFiles/python_binding.dir/all] Error 2
make: *** [Makefile:146: all] Error 2
==> ERROR: A failure occurred in build().
    Aborting...

Not sure what I am doing wrong. Thank you.

It's still using the original xbmc/interfaces/swig/CMakeLists.txt

Unless you tell it otherwise makepkg will extract the source again and overwrite any changes you have made.

Offline

#10 2021-07-01 04:09:07

dafrizz
Member
Registered: 2011-05-27
Posts: 31

Re: [SOLVED] Kodi 19.1 Matrix high cpu and stuttering playback

Unless you tell it otherwise

Are you able to give me some guidance on how I do that ? I changed my PKGBUILD using the -S option, but that does not seem to fix it and I am getting the same error.

  # build x11 version last that will make it fallback in the launcher script
  echo "building kodi-x11"
  cmake -S "xbmc-${pkgver}-Matrix" \
    ${_cmake_common_args[@]} \
    -DCORE_PLATFORM_NAME=x11 \
    ../"xbmc-$pkgver-Matrix"
  make
}

Thank you.

Offline

#11 2021-07-01 15:34:44

Greg0
Member
Registered: 2021-06-28
Posts: 3

Re: [SOLVED] Kodi 19.1 Matrix high cpu and stuttering playback

dafrizz wrote:

Are you able to give me some guidance on how I do that ? I changed my PKGBUILD using the -S option, but that does not seem to fix it and I am getting the same error.

  # build x11 version last that will make it fallback in the launcher script
  echo "building kodi-x11"
  cmake -S "xbmc-${pkgver}-Matrix" \
    ${_cmake_common_args[@]} \
    -DCORE_PLATFORM_NAME=x11 \
    ../"xbmc-$pkgver-Matrix"
  make
}

Thank you.

Read the makepkg manual, and all should become clear!

Offline

#12 2021-07-03 08:35:59

dafrizz
Member
Registered: 2011-05-27
Posts: 31

Re: [SOLVED] Kodi 19.1 Matrix high cpu and stuttering playback

I had a look through the man pages but am none the wiser. Any chance you can give me some pointers ?

Offline

Board footer

Powered by FluxBB