PM4K / PlexMod for Kodi (18, 19, 20, 21, 22+)

This is not random. Plex always displays external subtitles below embedded ones.

Edit: huh, I see what you mean. Seems like a Plex bug

1 Like

I’ve now realised that while the issue is fixed for formats that can be passed through to my receiver (AC3), it’s still a problem with formats that can’t be passed through (E-AC3). Is there anything that can be done to make the audio start cleanly even when Kodi is having to decode it?

You can tell PM4K to force to AC3, which results in direct streaming from the PMS side of things, if necessary. Or play with refresh rate switching delay in kodi. It’s pretty much out of PM4Ks hands.

Edit: there’s a thread for the ideal kodi settings on the SHIELD, I can’t find it right now and the info might be old (you should be using omega), but worth a try as well

Edit 2: at least make sure dolby audio processing is disabled in the shield. You can also try sync playback to display in kodi (disables audio passthrough, though)

Edit 3: and, most importantly: Videoplayer cuts off about 500ms of audio at start of playback Ā· Issue #23535 Ā· xbmc/xbmc Ā· GitHub

Edit 4: Good god, this issue has been around forever

1 Like

0.7.9-beta18.1: script.plexmod.zip (2.8 MB)

Further CoreELEC stabilization, plex.direct fixes and additions.

Temporary Changelog:

  • Core/Player: Fix and stabilize relative double-seek edge-case (CoreELEC) (thanks @evertonmdz for the assistance)
  • SeekDialog/Player: Fix hitching when pausing with seek-back=0 (introduced with previous betas)
  • Core/Player: Use adjustable wait delay between seek attempts (CoreELEC)
  • Core/Player: Fix issue on CoreELEC where selecting new audio stream causes audio to stutter or delay (thanks @bowlingbeeg)
  • plex.direct/DNS: Take any locally connectable LAN connection into account as well when deciding whether plex.direct hosts need to be handled or not
  • plex.direct/DNS: Previous release fixes (stored servers were never checked for plex.direct handling)
  • plex.direct/DNS: Expand logging
  • AddonSettings: Add ā€œCoreELEC: Resume-fix wait for seekā€, default: 200ms
  • AddonSettings: Split ā€œIgnore plex.direct DNS handling for remote hostsā€ into ā€œplex.direct: Honor plex.tv’s dnsRebindingProtection flag (DNS)ā€ and ā€œplex.direct: Honor plex.tv’s publicAddressMatches flag (DNS)ā€, both default on

Edit: This should finally be stable enough, so I can start finalizing and merging the huge 16:10 (smaller aspect ratios) branch, to get the 0.7.9 release on the way

10 Likes

Hi, I just learned of this add-on for the first time. I’ve been using PlexKodiConnect (PKC) for some time now, and I’m wondering what’s the difference between this and PKC. I’m open to switch to using this if it seems better for me. (I’m using Android TV (Shield), if that matters)

Also, in addition to what the differences are, is there some video somewhere to see what this setup looks like?

Thanks.

Can someone in the community advise if PM4K can be run on the same device as PKC without causing problems? I’ve never used PKC.

If so, my advice to @cat_person48 would be to read post 1 in this thread and then have a tryout on his/her device. I’d be surprised if doing so wouldn’t lead to switching to PM4K.

Depending on how heavy PKC is on your Kodi instance while it fetches library updates for example, it could lead to PM4K or playback lagging, as we don’t have any control over its behaviour.

I’d advise to simply disable PKC while testing out PM4K (addons in Kodi can be disabled via the addon manager/addon info screen).

PKC connects directly to the kodi database and uses it to make a kodi libraries so it’s like a local library using the kodi gui.

PM4K is a TV UI frontend which loads its own UI on top of kodi and just uses the kodi video player.

PM4K is more of an app, everything is self-contained within.

PKC uses native Kodi interface, which allows skins to be used.

I’ve tried both, but PM4K is more robust for my relatively large setup (~250Tb). PKC would freeze/crash/etc.

I’ve never seen anything like this - did no one test this, or is it just stable for the CoreELEC guys now?

Dead silence :smiley:

Skipping around movies is definitely better for me in beta 18.1 - so far I haven’t seen any instances of the player exiting unexpectedly (which was happening on the previous builds)

Thanks for going the extra mile for us CoreELEC folks :smiley:

lol Been ā€œtestingā€ on a coreelec box the last few hours, ran into a few issues and just as I was gonna report realized I wasn’t using the latest beta oops.

Guess I gotta go ā€œtestā€ some more now.

Don’t know about anyone else but I am unable to resume a episode that has time left on it from the episode view. I press play and nothing happens. Only seen this bug a few times though, most of the time it’s fine.

Edit: sorry that was meant to be in reply to @panni

Can’t say I’ve noticed that (in recent builds), but I’ll post back if it happens to me

Logs! (and device info)

This was because of the seek fix for CoreELEC, which was introduced in the previous beta(s). It fixed the resume issues (not resuming at all) but tended to double-seek the relative offset (e.g., resume point was at 1:20h, video length 2:10h, actually used, bad resume point at 2:40h), resulting in a seek beyond the video length, effectively closing the video player. This should be fixed with beta18.1.

To reiterate: All of those things are due to the original CoreELEC issue, that seeking is bugged compared to ā€œnormalā€ Kodi instances, and leads to massive audio bugs/delay.

We’re really trying to make CE work for everyone, but all of those fixes are based on certain timing-related assumptions, which can vary from CE device to CE device. If you experience unexpected resume behaviour, please go to addonSettings of PM4K and increase the CoreELEC: Resume-fix wait for seek by 50ms at a time, and please tell us which delay works for you for which device. Our current default (200ms) was tested by 1-2 users with a specific Ugoos device.

Edit: Clarifications

ā€œnothing happensā€ as in: doesn’t do anything? That’s nothing to do with the latest CE fixes (probably). Please track back betas and post logs for each if you can.

2 Likes

As in the sub menu to resume or start from the beginning doesn’t appear.

Thanks @panni , I have a Ugoos AM6B+ and the default settings are working well for me on the latest beta. As I say there was a marked improvement in reliability (specifically relating to skipping around a movie/jumping to a chapter) going from 18.0 to 18.1. I’ll post back if I notice anything unexpected going on though.

Please create a ticket on Github, thanks!

I dont have a github account and haven’t seen it since. Will chalk it up to luck.

PM4K unable to play episodes without Internet. While the movies screen works fine without internet, only problem is with seekdialog.py
Error Received without Internet:

2024-08-12 13:40:04.058 T:15156   error <general>: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
                                                    - NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
                                                   Error Type: <class 'AttributeError'>
                                                   Error Contents: 'NoneType' object has no attribute 'binge_mode'
                                                   Traceback (most recent call last):
                                                     File "C:\Users\Administrator\AppData\Roaming\Kodi\addons\script.plexmod\lib\windows\kodigui.py", line 144, in onInit
                                                       self._onInit()
                                                     File "C:\Users\Administrator\AppData\Roaming\Kodi\addons\script.plexmod\lib\windows\kodigui.py", line 209, in _onInit
                                                       self.onFirstInit()
                                                     File "C:\Users\Administrator\AppData\Roaming\Kodi\addons\script.plexmod\lib\windows\videoplayer.py", line 151, in onFirstInit
                                                       self.play(resume=self.resume)
                                                     File "C:\Users\Administrator\AppData\Roaming\Kodi\addons\script.plexmod\lib\windows\videoplayer.py", line 358, in play
                                                       player.PLAYER.playVideoPlaylist(self.playQueue, resume=self.resume, session_id=id(self), handler=handler)
                                                     File "C:\Users\Administrator\AppData\Roaming\Kodi\addons\script.plexmod\lib\player.py", line 1411, in playVideoPlaylist
                                                       self._playVideo(resume and self.video.viewOffset.asInt() or 0, seeking=handler and handler.SEEK_PLAYLIST or 0,
                                                     File "C:\Users\Administrator\AppData\Roaming\Kodi\addons\script.plexmod\lib\player.py", line 1261, in _playVideo
                                                       self.handler.setup(self.video.duration.asInt(), meta, offset, bifURL, title=self.video.grandparentTitle,
                                                     File "C:\Users\Administrator\AppData\Roaming\Kodi\addons\script.plexmod\lib\player.py", line 260, in setup
                                                       self.dialog.setup(self.duration, meta, int(self.baseOffset * 1000), self.bifURL, self.title, self.title2,
                                                     File "C:\Users\Administrator\AppData\Roaming\Kodi\addons\script.plexmod\lib\windows\seekdialog.py", line 499, in setup
                                                       self.bingeMode = pbs.binge_mode
                                                   AttributeError: 'NoneType' object has no attribute 'binge_mode'
                                                   -->End of Python script error report<--
try:
            if self.player.video.type == 'episode':
                pbs = self.player.video.playbackSettings
                util.DEBUG_LOG("Playback settings for {}: {}", self.player.video.ratingKey, pbs)

                self.bingeMode = pbs.binge_mode
                self.handler.inBingeMode = self.bingeMode

                # don't auto skip intro when on binge mode on the first episode of a season
                firstEp = self.player.video.index == '1'

                if self.isDirectPlay or util.getUserSetting('auto_skip_in_transcode', True):
                    self.autoSkipIntro = (self.bingeMode and not firstEp) or pbs.auto_skip_intro
                    self.autoSkipCredits = self.bingeMode or pbs.auto_skip_credits

                self.showIntroSkipEarly = self.bingeMode or pbs.show_intro_skip_early
                self.handler.skipPostPlay = self.skipPostPlay = (self.bingeMode or pbs.skip_post_play_tv)

            # in transcoded scenarios, when seeking, keep previous marker states, as the video restarts
            if not keepMarkerDef:
                self.resetMarkerStates()
        except IndexError:
            self.doClose(delete=True)
            raise util.NoDataException

        self.showChapters = util.getUserSetting('show_chapters', True) and (
                bool(chapters) or (util.getUserSetting('virtual_chapters', True) and bool(self.markers)))
        self.setProperty('has.chapters', self.showChapters and '1' or '')

After removing the binge mode it works fine.