[RPi4] Weird delay on first play after start

  • Hi everyone.

    My apologies if this was discussed elsewhere, but I can't find anything... Maybe I am just bad at putting this into the right words.

    For a while now, I have this strange problem: After booting the first play takes ages to start. As I hit play, for up to two minutes Kodi does not respond at all. After this, it wakes up the HDD and finally starts playing. After this, the consecutive plays work just fine. This also happens for videos played via the Youtube addon. It seems to be a rather general issue. For me, this started fully out of the blue - I am not aware of an update or something alike that may have caused this.

    I'm running LibreElec 12.2.1 on a RPi4. The RPi is connected to a rather ancient Samsung TV. Additionally, there is an HDD directly attached to the RPi via USB as storage.

    Any ideas?

  • Please provide a full debug log.

    How to post a log (wiki)

    1. Enable debugging in Settings>System Settings>Logging
    2. Restart Kodi
    3. Replicate the problem
    4. Generate a log URL (do not post/upload logs to the forum)

    use "Settings > LibreELEC > System > Paste system logs" or run "pastekodi" over SSH, then post the URL link
  • Code
    2026-07-09 20:31:46.691 T:1228    debug <general>: OnPlayBackStarted: CApplication::OnPlayBackStarted

    In the log this is the first invocation of a 'play' ^

    Code
    2026-07-09 20:31:48.494 T:1455    debug <general>: Open - av_find_stream_info finished

    Stream info search has completed within 2 secs ^

    Code
    2026-07-09 20:31:48.969 T:1455    debug <general>: CVideoPlayer::HandleMessages - player started 2

    And by this point audio has synced and playback is started ^

    So i'm not seeing a two minute delay from the invocation of playback to playback starting.

    Code
    2026-07-09 20:30:35.747 T:1279     info <general>: VideoInfoScanner: Starting scan ..
    ...
    2026-07-09 20:31:46.691 T:1228    debug <general>: OnPlayBackStarted: CApplication::OnPlayBackStarted

    However there's a 75 second gap between an update scrape/scan of the USB drive and the playback event starting. Do you have Kodi configure to update the library on start? .. perhaps this is the delay you are seeing?

    Code
    Jul 09 20:31:28.529486 Raspberry sh[1197]: SG_IO: bad/missing sense data, sb[]:  f0 00 01 00 50 00 00 0a 00 00 00 00 00 1d 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
    Jul 09 20:31:28.530216 Raspberry sh[1197]: /dev/sda1:
    Jul 09 20:31:28.530216 Raspberry sh[1197]:  setting standby to 12 (1 minute)

    NB: This ^ is also logged in the journal, but this is harmless. It's the result of hdparm configuring standby on the drive and the USB/SATA adapter not implemented all of the SCSI command set (common on cheap SATA bridges) so the kernel doesn't see responses to everything it gave instructions on and it logs this.

  • However there's a 75 second gap between an update scrape/scan of the USB drive and the playback event starting. Do you have Kodi configure to update the library on start? .. perhaps this is the delay you are seeing?

    Yes, but this process is long over and done before I hit play the first time - so, this is not the cause of the delay.

    Important: This delay always happens at the first play, absolutely no matter how long Kodi was already running.


    I did another test and measured the time Kodi needed to respond: it was ~50 s (well, not 2 minutes, but still damn long)
    --> https://paste.libreelec.tv/unturfed-edra.log

    Code
    2026-07-10 19:47:51.744 T:1232    debug <general>: OnPlayBackStarted: CApplication::OnPlayBackStarted

    I did hit play more or less precisely at 19:47:00. This means Kodi kind of did not recognize it for said ~50 s. Also, the overlay displaying RAM, CPU etc freezes during my delay, I am not fully sure if the log is even working during this.


    Btw... The Log is full of thousands of this stuff... What is this?

    Code
    2026-07-10 19:47:47.596 T:1268    debug <CSettingsManager>: requested setting (label533) was not found.
  • Code
    2026-07-09 20:31:46.691 T:1228    debug <general>: OnPlayBackStarted: CApplication::OnPlayBackStarted
    2026-07-09 20:31:46.740 T:1228    debug <general>: CVideoGUIInfo::InitCurrentItem(videodb://recentlyaddedmusicvideos/2977)

    Maybe some sort of a database initialization. Don't attach the HDD for testing, and just play one file from another storage device.

  • Nope, does not change anything. Unplugged the HDD and tried to play something directly from the internal file system - same issue...

    Plus, as I said, this also happens when I try to stream something via Youtube.

  • Thanks. Please edit this entry to "1" (default) at advancedsettings.xml, and reboot:

    Code
    <videolibrary>
    	<dateadded>0</dateadded>
    </videolibrary>

    Maybe it takes too long to get the current time.

  • For kicks I would take a spare SD card and the latest LE13 nightly and see if the problem is repeatable with default Estuary skin and stock configuration and without the unmaintained VPN addon that fills your logs with junk.

  • Dang! Took longer than I expected until someone suggests to try "fresh install" or something like that :P
    For the moment I do not have the time to start something from scratch, but I'll keep it in mind...

    Concerning VPN:

    1. I tested it with the addon _deactivated_, but that did not fix anything, thus I reactivated it.
    2. I know that the latest version of the addon is over 3 years old. Maybe I should give the WireGuard addon a try...
      Does not support Proton... Any suggestions?
  • Dang! Took longer than I expected until someone suggests to try "fresh install" or something like that :P
    For the moment I do not have the time to start something from scratch, but I'll keep it in mind...

    Concerning VPN:

    1. I tested it with the addon _deactivated_, but that did not fix anything, thus I reactivated it.
    2. I know that the latest version of the addon is over 3 years old. Maybe I should give the WireGuard addon a try...
      Does not support Proton... Any suggestions?

    You can use any WireGuard client that also matches official specifications to connect to Proton VPN servers using WireGuard. https://github.com/BrodjagaRatnik…via-Custom-Mode If you have any problems you can always ask me.

  • Dang! Took longer than I expected until someone suggests to try "fresh install" or something like that :P
    For the moment I do not have the time to start something from scratch, but I'll keep it in mind...

    "Dang", you should do that meantime or before asking help... You don't have a hour to try a basic fresh install, an easy thing with a RPi and a spare SD card, instead waiting for others to find what's wrong with your stuff.

  • I hoped that there might be a simple explanation with a hopefully rather simple solution that I am not able to see (happened before, trust me).

    Fresh installs are somewhat troublesome for me - I always have a big share of Murphy's law and I will for sure need more than just an hour (already granted I can dig up an usable SD card here)...

    To phrase it in a metaphor: I do not want to break down my whole house due to a single squeaky door before I have had a carpenter check on it.

    ------------------

    Besides, and I mean that in the most positive way: If you think that I am wasting everybody's time with my nonsense and that I should f**k off asap, then why do you spent your time by yourself to write that answer?! Seriously? Why? Just leave me and my stupid question alone and do something else with your time that makes you happy.

    And for the record: I am not requesting anything here, I am asking for help - everybody is free to pass on this thread and myself. And I am grateful for all the input that came from chewitt and Da Flex although my issue is still there. I still hope that someone might pop-up with an solution that is not called "fresh install", but even if that is the only solution - then, I can deal with it.

    Cheers, AvB :P

  • There is nothing obvious in the logs. Hence I've asked you to follow basic common sense troubleshooting 101 basics using a spare SD card. I'm not going to request it a second time. Your call on the next move.