Audio Stutter w RPi 4b since LE 11 upgrade

  • Hi, I've been running LE on an RPi 4b with 4GB RAM for quite awhile.

    Since upgrading to v11 (11.0.1 iirc, currently on 11.0.3), it's been stuttering on ALL video playback (NAS files and YouTube, multiple formats).

    The stutter is every few seconds, and is annoying for music and makes speech very hard to understand. It does it as soon as you start the video, doesn't matter time or temperature.

    However, music (MP3) files play perfectly fine.

    I am using the analog output on the Pi, to a dumb stereo with no surround sound, etc.

    I have tried setting the TV to 1080p as well as 4k, no difference.

    I've tried disabling all unnecessary plugins, no difference.

    The Pi4b is in a case with integrated heatsink and is not hot.

    Let me know what other info I can provide. I know how to SSH into it, etc.

    Thanks!

  • Hi, I've now set everything per those recommendations, but audio is still stuttering every few seconds.

    I've also tried enabling playback sync, and toggled the PRIME render method.

    Thanks!

  • Nope, works great. It's probably your analog audio, can't imagine a lot of people use it. Try using HDMI audio and rule that out.

    OK, yes, HDMI PCM to the Samsung TV works better. (but my receiver doesn't have HDMI, nor does the TV have an Audio Out.)

    I now also see that the BlueTooth output works. (But if I tie LE to the BT, I can't use it for portable devices.)


    Can the analog output issue be filed as a bug/regression? I was using it for several years until it broke in v11.

    Thanks!

  • By the way, it wouldn't hurt to turn on debug and upload a log file.

    Log Files - LibreELEC.wiki

    It might help with more informed answers. The HDR/4K guide is also something to follow closely, IIRC LE11 or LE10 defaulted the GUI to the highest resolution and 4K is absolute murder for RPi4, especially if it is upscaling 1080p content to 4K. You definitely want to make sure you set your display resolution to 1080p and use whitelists/adjust refresh rate if you need to play 4K content.


    Can the analog output issue be filed as a bug/regression? I was using it for several years until it broke in v11.

    I am not sure if it's LE or the kernel, but you can certainly log an issue. Might be good to try an LE11 nightly, as it should have a later kernel. Or if you are brave, the LE12 nightly is pretty stable.

    LibreELEC official nightly builds

    Edited once, last by frakkin64: Merged a post created by frakkin64 into this post. (November 2, 2023 at 10:48 PM).

  • By the way, it wouldn't hurt to turn on debug and upload a log file.

    Log Files - LibreELEC.wiki

    It might help with more informed answers. The HDR/4K guide is also something to follow closely, IIRC LE11 or LE10 defaulted the GUI to the highest resolution and 4K is absolute murder for RPi4, especially if it is upscaling 1080p content to 4K. You definitely want to make sure you set your display resolution to 1080p and use whitelists/adjust refresh rate if you need to play 4K content.


    I am not sure if it's LE or the kernel, but you can certainly log an issue. Might be good to try an LE11 nightly, as it should have a later kernel. Or if you are brave, the LE12 nightly is pretty stable.

    LibreELEC official nightly builds

    Thanks, I'm definitely in 1080p mode right now. (confirmed on the TV as well)

    I'll turn on debug mode...

  • I tried the v11 10-30 nightly (LibreELEC-RPi4.arm-11.0-nightly-20231030-d202143.img.gz),

    the same stutter is present.


    and the v12 nightly (LibreELEC-RPi4.aarch64-12.0-nightly-20231101-e7215dd.img.gz) has the same stutter.

    thanks

    Edited once, last by barry: Merged a post created by barry into this post. (November 3, 2023 at 2:11 AM).

  • If you're going to share a log please share the whole log, else we miss a bunch of stuff that is important. Rinse/repeat with the v12 nightly.

    Sorry, I cut it down to fit it into PasteBin, but then they deleted it anyways; here's the full log from v11.0.3 (attached)

    Thanks!

    highlights:

    16:07:35

    (set back to analog output)

    ...

    played a YouTube video

    16:11:18

    Played a 720p MOV file (GNK-01-01-01-Basic_Lightroom_Workflow.mov)

    16:12:48

    played test2-720p-DTS-x264.mkv

  • Code
    2023-11-02 16:11:19.182 T:7971     info <general>: [WHITELIST] Searching the whitelist for: width: 1280, height: 720, fps: 15.000, 3D: false
    2023-11-02 16:11:19.182 T:7971    debug <general>: [WHITELIST] Searching for an exact resolution with an exact refresh rate
    2023-11-02 16:11:19.183 T:7971    debug <general>: [WHITELIST] No match for an exact resolution with an exact refresh rate
    2023-11-02 16:11:19.183 T:7971    debug <general>: [WHITELIST] Searching for a desktop resolution with an exact refresh rate
    2023-11-02 16:11:19.184 T:7971    debug <general>: [WHITELIST] No match for a desktop resolution with an exact refresh rate
    2023-11-02 16:11:19.184 T:7971    debug <general>: [WHITELIST] No resolution matched
    2023-11-02 16:11:19.184 T:7971     info <general>: Display resolution ADJUST : 1920x1080 @ 29.970032 Hz (34) (weight: 0.000)

    You haven't enabled debug and then rebooted before playing things so the front part of the log is missing debug information on what the WHITELIST configuration is, but a number of the YouTube videos and the above show the same thing: media is not finding a correct mode in the whitelist for the type of media being played. Several YouTube plays show 720@30p media and Kodi picking [email protected] which is going to result in corrections, and those are likely the source of the audio stutters. The log above is also weird since 720@15p is a really odd format to have things in. However with correct settings Kodi should be able to play it.

    Kodi needs to have adjust-refresh enabled (appears to be) and with 1080p@60/59.94/50/24/23.976 modes selected (30/29.97/25 are omitted) and with "allow rate doubling" enabled. This should result in 29.97fps media being played at 59.94fps, and 15fps media being "doubled" up to play at 60fps (doubling isn't a completely accurate description). The 30/29.97/25 modes are normally omitted to allow interlaced media to be rendered correctly (each interlaced half-frame can be rendered in a full frame).

    TL/DR: I believe 1080@30 is not in the current whitelist although the log shows the TV supports this.

  • I am using the analog output on the Pi, to a dumb stereo with no surround sound, etc.

    Hi,

    Do you have audio-video synchronization issue between the HDMI video and the analog audio output? I tried to use same thing in the past with my RPi3B, and had that issue. Don't know is in the case of RPi4B is same situation. Also the analog audio output had poor sound quality. I switched to use the GPIO digital sound output (I2S). I'm using now this, it's cheap but need some wireing to be connected, or you can use an HifiBerry-Hat built with RPi GPIO comaptible connector. I think that analog audio is on the RPi just to have a minimal sound output, mostly when is used without display. Even for a "dumb stereo with no surround sound" should be used something better when you want to listening some music.

  • TL/DR: I believe 1080@30 is not in the current whitelist although the log shows the TV supports this.

    You're right, I only had 50, 59, & 60 selected. I've now enabled ALL the 1080p rates (the TV does support them all).

    HOWEVER, for 720p, the ONLY options available in the whitelist selector are 50, 59, & 60Hz. Those were all already selected.

    I didn't have "allow double refresh rates"enabled, fixed now, thanks!

    Kodi needs to have adjust-refresh enabled (appears to be)

    I don't see a specific setting for that, but it is switching rates on different media (acc to Kodi & the TV).

    Currently Testing:

    Files:

    24.000 720p h.264 (rendered at 1080p 24Hz; also see 3:2 below) - stutters

    23.976 480p mpeg4 (rendered at 1080p 23.98Hz) - stutters

    23.976 1080p h.264 - stutters

    23.976 1080p h.265 - stutters

    24.000 1080p h.264 - stutters

    24.000 2160p h.264 - stutters

    25.000 480p mpeg4 (rendered at 1080p 25Hz) - stutters

    25.000 2160p h.265 - stutters

    29.917(?) 2160p h.264 - stutters (LG Greece & Norway demo)

    29.970 2160p mpeg4 - stutters

    59.940 2160p h.265 (rendered at 1080p 59Hz) - stutters

    I also enabled 3:2 pulldown for the following:

    24.000 720p h.264, disp at 720p 60Hz - stutters

    YouTube:

    29.970 360p h.264 (rendered at 1080p 29Hz) - stutters

    23.976 720p h.264 (rendered at 720p 59Hz) - stutters

    29.970 720p h.264 (rendered at 720p 59Hz) - stutters

    24.000 1440p vp9 (rendered 1080p 24.00Hz) - stutters

    24.000 1440p vp9 (rendered 2160p 24.00Hz) - stutters

    23.976 2160p vp9 - stutters

    59.940 2160p vp9 (rendered at 1080p 59Hz) - stutters

    In other words, I can't find ANY video file or YT stream that doesn't have stuttering audio.

    Note that with BT audio out, there's no stuttering on any of these.

    And MP3 files play fine on analog out.

    And everything worked in LE 10.

    Thanks again!


    Do you have audio-video synchronization issue between the HDMI video and the analog audio output?

    No, it's perfect currently on my RPi4 w Samsung TV. (iirc I had an issue on an older Samsung and a PC)

    But my BT receiver is off by at least 1/8 sec.

    Note you can adjust the audio delay in the settings during playback.

    Edited once, last by barry: Merged a post created by barry into this post. (November 3, 2023 at 8:52 AM).

  • Remove all 720p modes and allow Kodi to upscale SD/720p content to 1080p (which is not taxing for hardware). This allows a wider range of refresh rates to see an exact match. You don't need to enable 3:2 pulldown as your TV supports exact modes.

    I also forgot to mention the <cache> options in advancedsettings.xml. Unless your network is broken (in which case the solution is to fix your network) cache fiddling is not required and frequently causes issues.

    No Pi board can hardware decode VP9 and RPi4 doesn't have quite enough CPU grunt to handle it consistently at 1080p in software so it's best to disable it in inputstream.adaptive settings so YouTube and similar add-ons default to H264 content. This will limit you to 1080p which is the max resolution for the H264 codec on RPi4. If you go above 1080p with H264 the media is software decoded and (again) there's not enough CPU to handle the task so stuttering is expected. NB: RPi5 can handle 1080p VP9 with no problems and a suprising amount of 4K VP and H264 media also plays; not everything is guaranteed but the 250% CPU performance bump adds headroom and more things are in range.

  • Does adding "audio_pwm_mode=1" to config.txt help?

    Hi, I already have

    dtparam=audio=on

    audio_pwm_mode=1

    in /flash/config.txt

    thanks!


    Remove all 720p modes and allow Kodi to upscale SD/720p content to 1080p (which is not taxing for hardware). This allows a wider range of refresh rates to see an exact match. You don't need to enable 3:2 pulldown as your TV supports exact modes.

    Will do, thanks.

    No Pi board can hardware decode VP9 and RPi4 doesn't have quite enough CPU grunt to handle it consistently at 1080p in software so it's best to disable it in inputstream.adaptive settings so YouTube and similar add-ons default to H264 content. This will limit you to 1080p which is the max resolution for the H264 codec on RPi4. If you go above 1080p with H264 the media is software decoded and (again) there's not enough CPU to handle the task so stuttering is expected.

    Mine can play YouTube up to 1440p 30fps (VP9, iirc) smoothly enough. I have it set to always ask which stream I want, so if it starts getting choppy or out-of-sync, I can stop it and start with a lower stream.

    Anyways, audio stutters even on the 720p 30fps and lower streams.

    I also forgot to mention the <cache> options in advancedsettings.xml. Unless your network is broken (in which case the solution is to fix your network) cache fiddling is not required and frequently causes issues.

    I had messed with that previously, in Oct 2021, as YouTube was performing horribly for a month or two (probably turned out it was not a network issue, but I was desperate). I lowered 'memorysize' back down already, but I will remove those settings now.

    Thanks again!

    Edited once, last by barry: Merged a post created by barry into this post. (November 3, 2023 at 10:57 PM).