Audio and Video out of sync on certain videos

  • Hi all.

    I am a brand new users of Kodi, and Libreelec - thanks for such a great bit of software.

    I installed it on an (admittedly) underpowered Raspberry Pi 2 Model B and configured *nothing* from the installed 10.0.0.2 version.

    I have a couple of videos on my USB and one of them works *perfectly*. The other is a better quality video and I am finding that the audio is quite far ahead of the actual video playback. I have done some research and note that there is a 'audio delay' slider on the playback of the video which can be adjusted - but the experience of this is fiddely and ideally shouldn't be required.

    Then there is an advancedsettings.xml people have been discussing where you can set a default for all videos, however my concern is that this 'delay' is different on every movie and therefore a big problem.

    I don't see why this is an issue on kodi - where I can play the same files on a mac or a windows PC without doing anything and the audio and video is in sync perfectly (clearly this isn't a video file based issue, more something on the method of playback)

    Is there any settings anywhere I should try flicking before I get into manually altering this delay on a video by video basis (which I likely won't do as its too much of a pain)?

    Thanks once again!

  • Enable "adjust refresh" so that Kodi switches to the native resolution of the video, and set the mode whitelist in video settings to use 60/59.94/50/24/23.976 modes. Then play some videos and see if that resolved it?

  • hi,

    So tried this out and it made no difference.

    I am starting to think by comparing playback on a Windows PC against Kodi, that the problem is that the video is actually playing slower and the audio is actually at the correct speed.


    None of these options have made any difference and the audio delay settings don't help because it is the video which seemingly is around 3 seconds slower than the audio (comparing the time taken to view the video to a specific recognised scene).

    Has anyone seen this before? Looking at top it doesn't look like the pi is overly stressed in terms of cpu or memory?

  • LybsterKodi - the problem is, it doesn't matter what I do to the audio delay setting - it almost has no effect. Very strange.

    At this point I cant use Kodi for the purpose I need it to.

    Could this simply be gtrying to watch 1080P videos on a Raspberry pi 2 is not really going to work?

    Edited once, last by renegadeandy (May 28, 2022 at 7:41 PM).

  • Could this simply be trying to watch 1080P videos on a Raspberry pi 2 is not really going to work?

    You could try if it works with LE 9.2.x as I think that it has a special implementation, which is not and will not be available with 10.x.y.
    Search on this forum to see if and how and with what constraints it could be possible.

    I don't see why this is an issue on kodi - where I can play the same files on a mac or a windows PC without doing anything and the audio and video is in sync perfectly (clearly this isn't a video file based issue, more something on the method of playback)

    The most likely explanation is that a mac or windows PC has FAR better/faster hardware then the RPi 2, which is a slow/underpowered device.

  • We'd need to know the format of the file you are trying to play, to know what the issue is.

    1080p24 (and up to 30) with a hw decode supported codec - h264, mpeg4, mpeg2 (with licence), vc-1 (with licence) should be fine.

    1080p60 may struggle (overclock can help).

    Software decoded formats (including hevc) will struggle.

    Post a debug log, or mediainfo of file and we can confirm.

  • Hi Popcornmix - thank you.

    The mediainfo for the file in question is :

    General

    Complete name : C:\Users\andya\Downloads\Big Buck Bunny.mp4

    Format : MPEG-4

    Format profile : Base Media

    Codec ID : isom (isom/iso2/avc1/mp41)

    File size : 286 MiB

    Duration : 10 min 34 s

    Overall bit rate : 3 784 kb/s

    Writing application : Lavf58.45.100

    Video

    ID : 1

    Format : AVC

    Format/Info : Advanced Video Codec

    Format profile : [email protected]

    Format settings : CABAC / 3 Ref Frames

    Format settings, CABAC : Yes

    Format settings, Reference frames : 3 frames

    Codec ID : avc1

    Codec ID/Info : Advanced Video Coding

    Duration : 10 min 34 s

    Bit rate : 3 386 kb/s

    Width : 1 920 pixels

    Height : 1 080 pixels

    Display aspect ratio : 16:9

    Frame rate mode : Constant

    Frame rate : 60.000 FPS

    Color space : YUV

    Chroma subsampling : 4:2:0

    Bit depth : 8 bits

    Scan type : Progressive

    Bits/(Pixel*Frame) : 0.027

    Stream size : 256 MiB (89%)

    Title : ISO Media file produced by Google Inc.

    Writing library : x264 core 155 r2901 7d0ff22

    Color range : Limited

    Color primaries : BT.709

    Transfer characteristics : BT.709

    Matrix coefficients : BT.709

    Codec configuration box : avcC

    Audio

    ID : 2

    Format : AAC LC

    Format/Info : Advanced Audio Codec Low Complexity

    Codec ID : mp4a-40-2

    Duration : 10 min 34 s

    Bit rate mode : Constant

    Bit rate : 384 kb/s

    Channel(s) : 6 channels

    Channel layout : C L R Ls Rs LFE

    Sampling rate : 48.0 kHz

    Frame rate : 46.875 FPS (1024 SPF)

    Compression mode : Lossy

    Stream size : 29.2 MiB (10%)

    Title : ISO Media file produced by Google Inc.

    Default : Yes

    Alternate group : 1

  • Yes, I think 1080p60 is a struggle on a Pi2.

    You could try overclocking. e.g. add:

    Code
    core_freq=500
    h264_freq=500
    over_voltage=6

    Does it help? You may be able to go up to 550 or 600 (but with overclocking, YMMV).

  • Good to know popcornmix.

    Where exactly do I add those lines to setup that? I assume it'll be on a file somewhere?

    If the CPU would then be considered the bottleneck - why do I not see 100% cpu usage when playing back that video in question !?

  • Okay makes sense.

    I see that:

    core_freq == GPU core frequency - makes sense to overclock that

    h264_freq == Hardware video frequency - guess it needs to be in sync with the core_freq?

    over_voltage == Due to overclocking the above?