Raspberry Pi 4: Audio problems playing TS streams

  • I recently switched from an Intel NUC to a Raspberry Pi 4. In general it is working fine but with videos recorded with my Vu+ Cable Receiver I get distorted/broken sound.

    I recorded a video here (best to hear end the end of the video):

    https://www.dropbox.com/s/e9ehjhl69n16fzz/20191129_120257.mp4?dl=0

    The videos in question are TS-files using H.264 video with AC-3 sound. This is a short clip that shows the problem on my RPi 4:

    Dropbox - test_copy.ts - Simplify your life

    I fiddled around with ffmpeg to find out what the problem is and found out that the problem disappears when reencoding video (also with H.264 (!)). When I reencode to H.264 video using this command:

    Code
    ffmpeg -i "recorded_video.ts" -acodec copy -vcodec h264 -ss 00:00:00 -t 00:00:40 test_h264.ts

    This is the result:

    Dropbox - test_h264.ts - Simplify your life

    Then that video play fine. So maybe it is somehow related to the encoded video that also affects audio playback?

    Here is a Kodi debug log file from playing the problem video:

    http://ix.io/236g

    Can anyone help? Thanks!

  • Code
    2019-11-29 12:31:15.857 T:2858812272   ERROR: ffmpeg[AA660370]: [matroska,webm] EBML header parsing failed
    2019-11-29 12:31:15.857 T:2858812272   ERROR: Open - Error, could not open file smb://ben/mass2/Video/jaun.mkv
    2019-11-29 12:31:15.857 T:2858812272   ERROR: ExtractThumb - Error creating demuxer

    Maybe the source file has errors, and re-encoding it by ffmpeg fixes it. Go into analysis of the source file.

  • Ahh, sorry "jaun.mkv" actually is not the file in question. That was just a misclick of mine. The file in question is "test_copy.ts".

    Also some more points to add:

    * it also happens when watching live TV from my Vu+ (not only limited to recorded files)

    * the problem did not occur when I was using an Intel Atom based machine. It popped up after switching to RPi4. So I assume the problem is specific to RPi4

    * the problem goes away when deactivating hardware accleration "MMAL" in Kodi options. But since I assume decoding is done by the CPU then I would like to avoid that

  • Sorry for not mentioning that I am using analog output. I thought it doesn't matter cause some days ago I thought to also have the problem via HDMI. But yesterday I could not reproduce it on HDMI audio output anymore.

    Anyway, the passthrough setting does not make a difference for me on the analog output. I think that is expected though. Thanks anyway!

  • Hi,

    I've the same problem with my RPi4. When I play TS Stream/file with VLC (or KODI on the TV-Hat stream), the audio is distorded.

    The audio with the same stream/file on my PC is fine.

    If I convert the file in mp4, the sound is fine.

    Do you find a solution ?

    Thanks.

  • I ended up buying a USB sound card which fixed the problem (besides one quite loud crackling sound at boot). But I will also try the fix Da Flex just posted. Thanks.

  • Please try this advancedsettings.xml:

    Code
    <advancedsettings version="1.0">
        <cache>
            <buffermode>4</buffermode>
            <memorysize>7000000</memorysize>
            <readfactor>4</readfactor>
        </cache>
    </advancedsettings>

    Always the same problem. The problem exist also with VLC, then is it more a system/hardware problem ?

  • I don't think.

    The solution :


    In kodi: Settings/video settings/Deinterlace method Off

    Yep, fixed it for me, TV was unwatchable with interlacing enabled - juddering and out of sync mess. Rpi4 + TVHeadend. Switched to a totally different system (Xbian) because it was driving me nuts. Didn't make any sense at all that it could play a 160GB 4k video but not 1080i/480i TV. Tried three different PVR backends/frontend over the last few days!

    :thumbup::thumbup::thumbup::thumbup::thumbup:

  • Yep, fixed it for me, TV was unwatchable with interlacing enabled - juddering and out of sync mess. Rpi4 + TVHeadend. Switched to a totally different system (Xbian) because it was driving me nuts. Didn't make any sense at all that it could play a 160GB 4k video but not 1080i/480i TV. Tried three different PVR backends/frontend over the last few days!

    :thumbup::thumbup::thumbup::thumbup::thumbup:

    Worth remembering that h.264 and interlaced content are handled by totally separate parts of the Pi4B SoC to h.265/hevc. The h.264/interlaced stuff is decoded and deinterlaced by the legacy VPU that remains the same as the Pi 3B+ and before, whereas the hevc/h.265 decoder is a separate unit and handled separately. I believe some builds at the moment are not handling stuff particularly effectively using the old decoder?