Audio Delay Option stuttering issue (1 Viewer)

Eggert

MP Donator
  • Premium Supporter
  • May 23, 2005
    70
    6
    Hi,

    I just upgraded from MP 1.6.0 to MP 1.8.0 and use the LAV audio codecs.

    Since my Sony TV has a huge video lag, I need to calm down my AV receiver.
    I need an audio delay of round about 100ms. When I set the delay higher than ~40ms, every 400th frame there is a small stop (only a few ms) of the stream and the counter of the frames starts again (checked when using keystroke "CTRL-1" when watching TV in Mediaportal).
    Seems to be like a buffer is getting full and has to get resetted or something like that.

    I had this issue since MP 1.3.0 where I first experimented with the audio delay option.
    There I could manage to get a delay up to 70ms, but above this issue appeared.
    With MP 1.8.0 this option is even more sensitive as described above.

    I first thought this is a bug within the LAV codec but the developer said:
    "LAV only adjusts the audio timestamps when you apply a delay, not more. If something causes issues here, its not LAV.
    It works with any audio [means stereo or 5.1], and in theory any delay."
    This is why I posted here and not in the codec section.

    In the attachment you can find a TsReader.log and I think you can see the issue there, maybe for example here:
    "Pause 195 mS renderer clock to match provider/RTSP clock, A/V = 2/14"

    Any help is highly appreciated since I cannot live with audio and video being out of sync. :)
    If someone could verify this by setting the audio delay to 200ms and describes what happens, that would be nice.

    Thanks!
    Regards,
    Eggert
     

    Owlsroost

    Development Group
  • Team MediaPortal
  • October 28, 2008
    5,540
    5,038
    Cambridge
    United Kingdom United Kingdom
    Country flag
    Eggert - can you open up Regedit, navigate to 'HKEY_CURRENT_USER\Software\Team MediaPortal\TsReader' and open the "BufferingDelayInMilliSeconds" value.

    It is zero by default - please try changing it to (decimal) 200 or (hex) C8 - this will force TsReader.ax to buffer 200ms more data internally. It means that you'll have to wait 200ms longer after every channel change before it can start playing, though.

    See if that helps with the problem.
     

    Eggert

    MP Donator
  • Premium Supporter
  • May 23, 2005
    70
    6
    Hi Owlsroost,

    I just played a bit with that registry setting and finally put it up to (dec) 1500 ms and set LAV to 200 ms.
    I also tried registry to (dec) 200 ms and LAV to 50 ms.
    I restarted MP after each of the changes and recognized the long channel changes.

    The issue hasn't been solved. Max ~40 ms work well.

    I attached a TsReader.log with the 1500 / 200 setting. It seems to be slightly different than the first one.

    btw: when connecting to the TV-service of this computer with my laptop, I can set an audio delay up to ~350 ms with no problem. Why could this be? The laptop is a really old one compared to the HTPC.
    Same MP version.

    Regards
    Eggert
     
    Last edited:

    Owlsroost

    Development Group
  • Team MediaPortal
  • October 28, 2008
    5,540
    5,038
    Cambridge
    United Kingdom United Kingdom
    Country flag
    OK - that points to a slightly different area of the code which is probably causing the issue.

    I'll build you a modified TsReader.ax to try.



    What this means (from the log):

    Code:
    [2014-07-17 22:00:04,667] [13aeef00] [23dc] - audPin : Audio to render late= -0.106
    [2014-07-17 22:00:04,667] [13aeef00] [23dc] - Aud/Ref : 25.567, Compensated = 25.544 ( -0.106 A/V buffers=21/46), Clk : 25.650354, SampCnt 176, Sleep 1 ms, stallPt 1.100
    [2014-07-17 22:00:04,817] [13aeef00] [23dc] - Aud/Ref : 25.711, Compensated = 25.688 ( -0.112 A/V buffers=22/47), Clk : 25.800354, SampCnt 177, Sleep 1 ms, stallPt 1.100
    [2014-07-17 22:00:04,957] [13aeef00] [23dc] - Aud/Ref : 25.855, Compensated = 25.832 ( -0.108 A/V buffers=22/49), Clk : 25.940438, SampCnt 178, Sleep 1 ms, stallPt 1.100
    [2014-07-17 22:00:05,097] [13aeef00] [23dc] - Aud/Ref : 25.999, Compensated = 25.976 ( -0.104 A/V buffers=21/46), Clk : 26.080417, SampCnt 179, Sleep 1 ms, stallPt 1.100
    [2014-07-17 22:00:05,247] [13aeef00] [23dc] - Aud/Ref : 26.143, Compensated = 26.120 ( -0.110 A/V buffers=20/44), Clk : 26.230375, SampCnt 180, Sleep 1 ms, stallPt 1.100
    [2014-07-17 22:00:05,387] [13aeef00] [23dc] - Aud/Ref : 26.287, Compensated = 26.264 ( -0.106 A/V buffers=22/50), Clk : 26.370375, SampCnt 181, Sleep 1 ms, stallPt 1.100
    [2014-07-17 22:00:05,537] [13aeef00] [23dc] - Aud/Ref : 26.431, Compensated = 26.408 ( -0.112 A/V buffers=21/47), Clk : 26.520396, SampCnt 182, Sleep 1 ms, stallPt 1.100
    [2014-07-17 22:00:05,677] [13aeef00] [23dc] - Aud/Ref : 26.575, Compensated = 26.552 ( -0.108 A/V buffers=20/44), Clk : 26.660354, SampCnt 183, Sleep 1 ms, stallPt 1.100
    [2014-07-17 22:00:05,817] [13aeef00] [23dc] - Aud/Ref : 26.719, Compensated = 26.696 ( -0.104 A/V buffers=22/53), Clk : 26.800396, SampCnt 184, Sleep 1 ms, stallPt 1.100
    [2014-07-17 22:00:05,967] [13aeef00] [23dc] - Aud/Ref : 26.863, Compensated = 26.840 ( -0.111 A/V buffers=21/50), Clk : 26.950521, SampCnt 185, Sleep 1 ms, stallPt 1.100
    [2014-07-17 22:00:06,107] [13aeef00] [23dc] - Aud/Ref : 27.007, Compensated = 26.984 ( -0.106 A/V buffers=20/45), Clk : 27.090375, SampCnt 186, Sleep 1 ms, stallPt 1.100
    [2014-07-17 22:00:06,164] [13aeef00] [1dac] - Pause 321 mS renderer clock to match provider/RTSP clock, A/V = 19/45
    [2014-07-17 22:00:06,165] [13aeef00] [1dac] - CTsReaderFilter::Pause() - IsTimeShifting = 1 - state = 2
    [2014-07-17 22:00:06,165] [13aeef00] [1dac] - CTsReaderFilter::Pause() - END - state = 1
    [2014-07-17 22:00:06,486] [13aeef00] [1dac] - CTsReaderFilter::Run(177675.60) state 1 seeking 0
    [2014-07-17 22:00:06,486] [13aeef00] [1dac] - Run() - Elapsed time from pause to Audio/Video ( total zapping time ) : 321 mS
    [2014-07-17 22:00:06,486] [13aeef00] [1dac] - CTsReaderFilter::Run(177675.60) state 2 -->done
    ....is that TsReader is detecting that the audio samples on it's output pin are late (relative to the renderer clock), so it assumes that there is a data starvation problem and attempts to correct it by pausing playback for a short time. It needs to do this sometimes to recover from stream corruption and when playback is running faster than the broadcast stream, but it's being triggered by the effect of the timestamp adjustments LAV Audio decoder is performing.
     

    Owlsroost

    Development Group
  • Team MediaPortal
  • October 28, 2008
    5,540
    5,038
    Cambridge
    United Kingdom United Kingdom
    Country flag
    Attached is a new version of TsReader to try - just replace the version in C:\Program Files\Team MediaPortal\MediaPortal (after making a backup copy of the original !)

    This has a new registry setting - "ExternalDelayCompInMilliSeconds". Set this to the same value (in milliseconds) as the audio delay in LAV and it should fix the problem. (Just play some TV/recording in MP to create the new reg key before you change it)

    Please let me know if it works :)
     

    Attachments

    Eggert

    MP Donator
  • Premium Supporter
  • May 23, 2005
    70
    6
    Brilliant!
    It works!!

    Thank you very much, I almost gave up - it was really worth asking here.

    Just to get sure:
    does it always have to be exact the same delay? Or can I use a higher value even if the LAV delay is lower without any disadvantage?
    The reason why I ask:
    I also use the Audio Renderer Changer (ARC) which is able to switch the audio output device on the fly (analog <--> digital).
    It has an option to import some registry values with every change.
    Because LAV does recognize the audio delay setting "live" (can be adjusted while playback within the registry) and the two audio devices need a slightly different audio delay value, it would be cool if your new setting would cover both values for both audio output devices without getting any disadvantage. I tried to change your new setting "live" but it will only get recognized when restarting the stream (which the ARC doesn't seem to do). Otherwise I could just add it to the registry files that ARC imports anyway for the LAV settings.

    I have made 3 requests on the forum this week of which 2 have been solved within a really short time.
    Just wanted to let you know that this great support is worth another donation.
    Thanks again.

    Eggert
     

    Owlsroost

    Development Group
  • Team MediaPortal
  • October 28, 2008
    5,540
    5,038
    Cambridge
    United Kingdom United Kingdom
    Country flag
    The setting is not critical - just set it to approximately the same as the highest delay you are using with LAV. The allowed values are between 0 and 999 ms.
    (What it's actually adjusting is the 'sample lateness detection' thresholds in TsReader, which are used to detect if it's running out of timeshift data and to help with recovery from signal corruptions.)
     

    Eggert

    MP Donator
  • Premium Supporter
  • May 23, 2005
    70
    6
    Would it be possible to automatically set the same value (+x) as LAV has (if using LAV) by copying the LAV registry setting?
    This would solve the problem for other users as well without searching the forums?

    [HKEY_CURRENT_USER\Software\LAV\Audio]
    "AudioDelayEnabled"=dword:00000001
    "AudioDelay"=dword:00000064

    Eggert
     

    Owlsroost

    Development Group
  • Team MediaPortal
  • October 28, 2008
    5,540
    5,038
    Cambridge
    United Kingdom United Kingdom
    Country flag
    I've thought about doing something like that, but I'd prefer to do something 'automatic' that would work for other decoders/renderers as well (just haven't thought of a way to do it yet ;))
     

    Users Who Are Viewing This Thread (Users: 0, Guests: 1)

    OP Similar threads Forum Replies Date
    Sebastiii [WiP] Audio delay when using LAV Audio codec Area 51 - Testing Area 6
    Stephen O'Kane [SOLVED] TV Stream stuttering - both Video and Audio Watch / Listen Media 14
    M.Hulot MP plays in Internal Blu-ray-Player-mode always first audio stream not the one I chosen in settings General Support 1
    Golf4 TV-Records werden als Audio-Files importiert ? Allgemeines Support- und Diskussionsforum 0
    W [solved] Incorrect audio being reported Moving Pictures 4
    404 [solved] Live TV...video and audio freeze General Support 20
    ninja 12 Audio dropouts with Dolby / DTS watch/edit Videos 12
    bta489 [solved] DVB-T2 Recordings: Sometimes no Audio after muxing with mkvmerge Tools and other software 2
    T [solved] MP2 Switch off visualisation when listening to audio....PLEASE!!! General 23
    azzuro [fixed] [WIP MP2.3] - Audio files not imported to MP MediaPortal 2 18
    S Remote button to change audio and subtitle on / off General 10
    F Audio render and font error in my logs General Support 2
    R [solved] Command / Shortcut for changing subtitles or audio Archive 5
    K Multichannel audio and subtitles for TV not properly supported General Support 4
    Glith Audio out of sync after pause. Rewind 15sec gets it into sync again. MediaPortal 1 Talk 0
    C ARC Audio Renderer Changer: wo kann man es konfigurieren? Video & DVD 15
    joecrow No Audio after MP Start/Resume from Sleep General Support 0
    C Ability to browse videos and audio by folder General 2
    Lichloathe Offline audio content General 9
    G How best to get cover art for tracks to show up on the Audio Menu (Latest Added, Unplayed)? General 9
    Ralph Holmes Wrong audio source in TV General 1
    CyberSimian [Proposal] Audio description MediaPortal 1 10
    ge2301 [fixed] [MP2-807] Problem when switching player in PiP mode with audio files MediaPortal 2 32
    cladinshadows85 [solved] Audio playing mutiple times over video and crashing General 8
    H Live TV info OSD not displaying number of audio channels General Support 3
    Similar threads

























    Top Bottom