Video very long to start when playing from UPnP/DLNA
#1
Hello.

I use Kodi 20.2 on Kubuntu 22.04 installed from the PPA depot, and overall, it works very well.
However, I have a strange issue with the video playback from UPnP/DLNA: after launching the video, it takes several minutes (~ 2-5 minutes) before the video effectively starts playing.
There is no issue when playing a video from a local disk or from Samba.
There is no issue when playing a video from UPnP/DLNA with VLC on the same machine: it starts immediately.

The UPnP server is Gerbera running on another Kubuntu 22.04 machine on the same local network.

Examples of log files:
dereyigugi.kodi (paste)
ulacobuxoh.kodi (paste)

Any suggestion?

Thanks.
Reply
#2
(2024-03-30, 20:59)cepamoi Wrote: Hello.

I use Kodi 20.2 on Kubuntu 22.04 installed from the PPA depot, and overall, it works very well.
However, I have a strange issue with the video playback from UPnP/DLNA: after launching the video, it takes several minutes (~ 2-5 minutes) before the video effectively starts playing.
There is no issue when playing a video from a local disk or from Samba.
There is no issue when playing a video from UPnP/DLNA with VLC on the same machine: it starts immediately.

The UPnP server is Gerbera running on another Kubuntu 22.04 machine on the same local network.

Examples of log files:
dereyigugi.kodi (paste)
ulacobuxoh.kodi (paste)

Any suggestion?

Thanks.

Have you disabled transcoding on the Gerbera server for this client ?  It looks like they may already have a VLC profile which is disabling trnanscoding but maybe not one for Kodi, which since it can't match the User Agent may invoke transcoding.   I run a different DLNA setup which already has all the profiles built, including for Kodi.  Anyway, this is my guess as to the cause.  You may need to look closer at the server status and logs when trying to play something with Kodi.


Thanks,

Jeff
Running with the Mezzmo Kodi addon.  The easier way to share your media with multiple Kodi clients.
Service.autostop , CBC Sports, Kodi Selective Cleaner and Mezzmo Kodi addon author.
Reply
#3
Hi Jeff,

Thanks for the suggestion.
However, it seems that transcoding is always disabled in Gerbera. The config file contains:
  <transcoding enabled="no">
I also checked the CPU usage on the server, and it is very low, while transcoding usually uses lots of CPU.
This confirms that there is no transcoding.

I checked the Gerbera log file, and there are some messages when I click to launch the video in Kodi, there are some other messages when the video effectively starts, but there is nothing in between (several minutes).

On the client side, I noticed that Kodi uses more CPU than usual (~40 %) while it is waiting for the video to start. When the video starts, the CPU usages drops to ~10-15 %.
I also noticed that the longer is the video, the longer I have to wait before it starts.

Thanks.
Reply
#4
This is not linux specific and was easy to reproduce with a gerbera docker. Kodi attempts to locate external subs in a non-standard way for uPnP sources.
The process fails quickly with some servers (ex. Kodi, minidlna) and takes a while with others (UMS, gerbera) with lots of unnecessary network traffic and CPU usage.

There is no fix or workaround at this time other than using a different uPnP server software with a quick failure or using a different protocol such as samba.

I'll think about a fix.

edit: fix submitted for review, 24922 (PR)
Always read the Kodi online-manual, the FAQ and search the forum before posting.
Do not e-mail Kodi Team members directly asking for support. Read/follow the forum rules (wiki).
For troubleshooting and bug reporting please make sure you read this first.
Reply
#5
(2024-03-31, 02:11)CrystalP Wrote: This is not linux specific and was easy to reproduce with a gerbera docker. Kodi attempts to locate external subs in a non-standard way for uPnP sources.
The process fails quickly with some servers (ex. minidlna) and takes a while with others (UMS, gerbera) with lots of unnecessary network traffic and CPU usage.

There is no fix or workaround at this time other than using a different uPnP server software with a quick failure or using a different protocol such as samba.

I'll think about a fix.

Is the Kodi player or UPnP code looking for the subs in a nonstandard way ?  If it is the UPnP code then @cepamoi could use another UPnP client on Kodi like the Mezzmo Kodi addon which has generic UPnP support.  If it is in the player code then your option is the only option.


Thanks,

Jeff
Running with the Mezzmo Kodi addon.  The easier way to share your media with multiple Kodi clients.
Service.autostop , CBC Sports, Kodi Selective Cleaner and Mezzmo Kodi addon author.
Reply
#6
(2024-03-31, 03:28)jbinkley60 Wrote: If it is in the player code then your option is the only option.

Yes it's the player code for any item with the protocol upnp. Not sure how the Mezzmo addon integrates in Kodi.
Always read the Kodi online-manual, the FAQ and search the forum before posting.
Do not e-mail Kodi Team members directly asking for support. Read/follow the forum rules (wiki).
For troubleshooting and bug reporting please make sure you read this first.
Reply
#7
(2024-03-31, 04:08)CrystalP Wrote: Yes it's the player code for any item with the protocol upnp. Not sure how the Mezzmo addon integrates in Kodi.

Thanks.  The Mezzmo Kodi addon may still be an option since Kodi UPnP doesn't need to be enabled for it to operate.  It has it's own SSDP discovery tool and handles parsing the XML responses from the DLNA / UPnP servers, including parsing for subs XML tags (if they exist).  It will handle URLs from the server which are either UPnP or HTTP and hand them to the player.  If the player, seeing the UPnP URL in the main video stream still tries to discover the subs, then it won't solve the issue.


Jeff
Running with the Mezzmo Kodi addon.  The easier way to share your media with multiple Kodi clients.
Service.autostop , CBC Sports, Kodi Selective Cleaner and Mezzmo Kodi addon author.
Reply
#8
Thanks your your replies.

I enabled more debugging in kodi.log, and @CrystalP is right. Kodi is searching for external subtitles and it takes a while:
2024-03-31 11:19:48.990 T:1690    debug <general>: ScanForExternalSubtitles: Searching for subtitles...
2024-03-31 11:21:49.935 T:1690    debug <general>: ScanForExternalSubtitles: END (total time: 120945 ms)

I tried to disable the search for external subtitles in the UPnP/DLNA settings, but it does not change anything: Kodi is still searching for external subtitles.
Reply
#9
@jbinkley60
I tried to install the Mezzmo Kodi addon, but it did not work, probably because it requires Kodi 19 and I'm using Kodi 20.2.
The Kodi log shows an obscure Python syntax error when I try to install the Mezzmo addon.
Thanks anyway.
Reply
#10
(2024-03-31, 11:57)cepamoi Wrote: @jbinkley60
I tried to install the Mezzmo Kodi addon, but it did not work, probably because it requires Kodi 19 and I'm using Kodi 20.2.
The Kodi log shows an obscure Python syntax error when I try to install the Mezzmo addon.
Thanks anyway.

You need to enable generic UPnP mode.  This is done by Disabling Only Show Mezzmo Servers and Only Discover Mezzmo Servers.  The 19+ version works with Kodi 19, 20 and 21.  If disabling the two options still doesn't work then I will need to see a snippet of your Kodi logfile which shows the UPnP server discovery process. 

It will look something like:

Mezzmo Server discovery process:
2024-03-31 10:48:30.702 T:19104    info <general>: Mezzmo server search: 9 UPnP servers found.
2024-03-31 10:48:30.739 T:19104    info <general>: Mezzmo UPnP server url: http://192.168.0.35:41952/description/fetch
2024-03-31 10:48:30.999 T:19104    info <general>: Mezzmo UPnP server url: http://192.168.0.35:53168/desc
2024-03-31 10:48:31.268 T:19104    info <general>: Mezzmo UPnP server url: http://192.168.0.34:53168/desc
2024-03-31 10:48:31.532 T:19104    info <general>: Mezzmo UPnP server url: http://192.168.0.34:52478/
2024-03-31 10:48:31.782 T:19104    info <general>: Mezzmo UPnP server url: http://192.168.0.35:2869/upnphost/udhisapi.dll?c

If you send me the Python error I can see what is happening.  Also note that there are 2 versions of the addon, one for Kodi 18 and below and the other for 19 and above.  The current 19 and above version is 2.2.0.3.


Thanks,

Jeff
Running with the Mezzmo Kodi addon.  The easier way to share your media with multiple Kodi clients.
Service.autostop , CBC Sports, Kodi Selective Cleaner and Mezzmo Kodi addon author.
Reply
#11
The Mezzmo addon always fails to initialize because of a Python error.
See here: odenuhesuc.kodi (paste)
I guess that the Mezzmo addon does not work with the Python version installed on Ubuntu 22.04 (Python 3.10.12).
Reply
#12
(2024-03-31, 18:34)cepamoi Wrote: The Mezzmo addon always fails to initialize because of a Python error.
See here: odenuhesuc.kodi (paste)
I guess that the Mezzmo addon does not work with the Python version installed on Ubuntu 22.04 (Python 3.10.12).

I don't believe it is related to the version of Python.  Version 3.10.12 shouldn't be a problem.  it looks to be something specific to your Linux setup.  What is odd is the error message being given says the print command is missing a close parenthesis but the line being pointed to is correct and works on all other systems.

Python command:

print("%s%s -> %s : %s" % (self.main, self.sub, inspect.stack(0)[2][3], msg))

The error is occurring during an import of this file which sets up the global environment variables.  I have an Ubuntu 22.0.4 setup but not one running Kodi.   If I get some time I will try to play with this and see if I can figure out what is unique to your setup but without Kodi being loaded I'll be limited.


Thanks,

jeff
Running with the Mezzmo Kodi addon.  The easier way to share your media with multiple Kodi clients.
Service.autostop , CBC Sports, Kodi Selective Cleaner and Mezzmo Kodi addon author.
Reply
#13
(2024-03-31, 18:34)cepamoi Wrote: The Mezzmo addon always fails to initialize because of a Python error.
See here: odenuhesuc.kodi (paste)
I guess that the Mezzmo addon does not work with the Python version installed on Ubuntu 22.04 (Python 3.10.12).

Digging deeper it looks like there may be some changes happening with the inspect module within Python between various versions of 3.5 through 3.12 and higher.  I've added some exception handling for this and posted a test version here.  Can you give it a try and see if it will load ?


Thanks,

Jeff
Running with the Mezzmo Kodi addon.  The easier way to share your media with multiple Kodi clients.
Service.autostop , CBC Sports, Kodi Selective Cleaner and Mezzmo Kodi addon author.
Reply
#14
Hi Jeff,

I tried the test version of the Mezzmo addon. The Python error is gone and the Mezzmo addon initializes properly.
However, I have a very odd behavior with Gerbera:
- Almost all the video files are missing.
- The only video file I have has the .ts extension. All the other video files (.mkv, .mp4, .avi, etc.) are missing.
- If I try to play the .ts file, Kodi does nothing for several minutes, then gets killed. There is nothing relevant in the log file.
- Some text files which are under Gerbera also appear in Mezzmo, and they can be viewed.
- The jpg images are missing too under the "PC directory" of Gerbera.
- But I could see the images files under the "Photos" shortcut of Gerbera, and they are displayed correctly.

As we are deviating from the original issue, I suggest the following:
1. continue the discussion about Mezzmo addon, Kodi, Gerbera on Kubuntu 22.04 in a separate thread.
2. as there are probably multiple issues with Mezzmo, please try to install Gerbera, Kodi and Mezzmo on a (K)ubuntu 22.04 machine (VirtualBox might be an option if you don't have a real machine available). That would be easier for you to reproduce the issues.

Thanks.
Reply
#15
Switching the UPnP server to minidlna gives much better results both with Mezzmo and with the native Kodi UPnP support.
However, Mezzmo requests to enable the native Kodi UPnP support, otherwise it does not play anything.
And Mezzmo is unable to display photos (while it works with the native Kodi UPnP support).
Reply

Logout Mark Read Team Forum Stats Members Help
Video very long to start when playing from UPnP/DLNA0