Rpi 4 B Audio Stutter

  • You might try copying one of the shows to a USB flash drive and then play the show from there to see if it works properly. The reason to try that is to eliminate the JBOD enclosure as a part of the problem.

    If I recall correctly, there were issues with some USB/SATA converters and slow speeds with the RPi4.

    See If you have a Raspberry Pi 4 and are getting bad speeds transferring data to/from USB3.0 SSDs, read this.

    Okay. Are you saying copy it to a USB 3.0 flash drive or USB 2.0 drive? Does it need to be a flash drive or can it be any drive? And once it is copied do you want me to access and watch the mkv file on the PI from the flash drive? Just for clarification.

    Should I also try to plug the enclosure into a USB 2.0 port instead of 3.0 to see if that fixes the issue? The enclosure is 3.0.

    I also plan on trying no buffer in advancedsettings.xml when I get the chance.

  • Okay. Are you saying copy it to a USB 3.0 flash drive or USB 2.0 drive? Does it need to be a flash drive or can it be any drive? And once it is copied do you want me to access and watch the mkv file on the PI from the flash drive? Just for clarification.

    Should I also try to plug the enclosure into a USB 2.0 port instead of 3.0 to see if that fixes the issue? The enclosure is 3.0.

    I also plan on trying no buffer in advancedsettings.xml when I get the chance.

    My suggestion is to try a USB flash drive (either USB 2.0 or USB 3.0 - both are fast enough for HD video) in order to eliminate any potential problem associated with USB to SATA converters.

    Of course feel to try all of the above since you are trying to troubleshoot an issue.

  • My suggestion is to try a USB flash drive (either USB 2.0 or USB 3.0 - both are fast enough for HD video) in order to eliminate any potential problem associated with USB to SATA converters.

    Of course feel to try all of the above since you are trying to troubleshoot an issue.

    Okay. Will try that.

    Do you think increasing the amount of memory used by Kodi could help?

  • My suggestion is to try a USB flash drive (either USB 2.0 or USB 3.0 - both are fast enough for HD video) in order to eliminate any potential problem associated with USB to SATA converters.

    Of course feel to try all of the above since you are trying to troubleshoot an issue.

    I transferred a TV show episode mkv file over to a Samsung Bar Plus USB 3.0 flash drive and connected it to the USB 3.0 port and played the video from there on the stable LibreElec build. After about 40 minutes, there was an audio dropout/stutter. Only one, but it was there. I have had only one happen before with my JBOD enclosure with mkv files as well. Sometimes I have multiple dropouts/stutters with them. There’s no discernible pattern. They seem to happen randomly. I am using audio passthrough in all situations.


    I have not edited advancedsettings.xml to stop buffering yet, as was mentioned above in this post. Also, quick question on that, do I place the XML file in the root directory or where do I put it in the LibreElec folder hierarchy?

  • I think your microSD is fine, otherwise you would find errors at kodi.log. You can play with cache settings at advancedsettings.xml. Maybe it's just a buffer overflow, and buffer mode 3 (no buffer) can fix it.

    On my stable build, I created an advancedsettings.xml and set buffer to 3 and stored it in /storage/.kodi/userdata. Watched a mkv and it still stuttered the audio eventually and looked like a quick video stutter as well during some of those audio drops.

    I should note the original audio track of these MKVs tend to be DTS HD Master. Though the stable build uses regular DTS of course.


    Don't know what else to do. May watch some of the stuttering videos on another computer to make sure it is not bad rips.

  • The fix I used was to increase the minimum clock frequency for both the ARM and the GPU by adding entries in config.txt

    What do you think of this?

    It's worth to try. I would add force_turbo=1 to config.txt. The SoC's clock frequency will stay constantly at max then. So if it's a SoC frequency issue while playing video (speed down -> speed up...), this should fix it.

    Re-ripping is also a good idea.

  • It's worth to try. I would add force_turbo=1 to config.txt. The SoC's clock frequency will stay constantly at max then. So if it's a SoC frequency issue while playing video (speed down -> speed up...), this should fix it.

    Re-ripping is also a good idea.

    Some questions:

    1. Where is the config.txt located?

    2. You're just saying add force_turbo=1, nothing else? Am I overclocking? What would you recommend for the settings for RPI 4B 8 GB RAM?

    3. Where do I add this in the txt file?

    4. Can this be undone?

    5. Should I re-rip first?

  • 1. Where is the config.txt located?

    Click!

    2. You're just saying add force_turbo=1, nothing else? Am I overclocking? What would you recommend for the settings for RPI 4B 8 GB RAM?

    Yes, that's all you need, and it fits for your device. It's no real overclocking, the RPi just stays at max regular clock level.

    3. Where do I add this in the txt file?

    Location doesn't matter, just make it the last line of config.txt.

    4. Can this be undone?

    Yes, just remove the line again. You will not lose your guarantee by using that option.

    5. Should I re-rip first?

    No, try overclocking first. If it doesn't work, remove overclocking and re-rip.

  • Click!

    Yes, that's all you need, and it fits for your device. It's no real overclocking, the RPi just stays at max regular clock level.

    Location doesn't matter, just make it the last line of config.txt.

    Yes, just remove the line again. You will not lose your guarantee by using that option.

    No, try overclocking first. If it doesn't work, remove overclocking and re-rip.

    Thank you. This helps me.

    So force turbo is a form of overclocking, but not going all the way with voltage changes, etc? So I don't lose my warranty?

    And I suppose if I don't want to force turbo 1 I can just add a # to that line in the config file and it will ignore my force turbo additional line?

  • PS: Another hint, not related to config.txt. /storage/.kodi/userdata/advancedsettings.xml should look like this to avoid buffering:

    Code
    <advancedsettings version="1.0">
        <cache>
            <memorysize>0</memorysize>
            <buffermode>3</buffermode>
        </cache>
    </advancedsettings>

    Ok when I built my xml I didn’t add the memorysize line. Just buffermode line. Didn’t think I needed memory size. So are you saying I didn’t actually disable buffering after all?

    And set memorysize to 0?

    This what I put in advancedsettings.xml. Do I need the version portion in the xml?

    Code
    <advancedsettings>
      <cache>
        <buffermode>3</buffermode>
      </cache>
    </advancedsettings>
  • You have disabled buffering with buffer mode 3. A minimum of necessary data still goes into RAM. With memory size 0 you will use microSD instead of RAM. To avoid an early death of your microSD, use memory size 0 just for testing, not for permanent usage.

    What's the result of your overclocking test?

    Which LE version do you use for testing?

    Does pastekodi show any unusual output when you get audio errors? If yes, post the link.

  • You have disabled buffering with buffer mode 3. A minimum of necessary data still goes into RAM. With memory size 0 you will use microSD instead of RAM. To avoid an early death of your microSD, use memory size 0 just for testing, not for permanent usage.

    What's the result of your overclocking test?

    Which LE version do you use for testing?

    Does pastekodi show any unusual output when you get audio errors? If yes, post the link.

    I will get back to you on those questions. I am using the current stable version of LibreElec mostly, but also tested a recent nightly build and same problem.

    Just so you know, I have also tested on Xbian and it does the same thing.

    It seems to be toward the end of Star Trek: Enterprise’s 45 min episodes (most of the time, not always). If I watch one of those. Oddly enough.

    Also, another question. Do I need version="1.0"> in my XML file at the top or does it matter?

    Edited 7 times, last by Matthewlawson3 (February 14, 2021 at 11:10 PM).

  • That's for parsing XML. Kodi will parse fine without that version attribute. Your choice.

    Okay. Very good. I ran the debug, not for sure if it picked up anything. I must of accidentally erased the minutes in which the dropout happened by disabling and re-enabling the log. The time at which the drop out happens wasn’t there. May do it again tomorrow and post to see if you see anything.

    I haven’t forced turbo yet, but it was in the config file already (see below). Looks like I just have to change the number, write out, save, and exit. Should I also adjust GPU memory?

    Code
    # Set 'force_turbo=1' to disable dynamic overclocking and enable overclocking always.
    force_turbo=0