[PATCH] Global AV delay support via advancedsettings.xml

  Thread Rating:
  • 2 Votes - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Reply
a11599 Offline
Team-XBMC Member
Posts: 298
Joined: Sep 2010
Reputation: 3
Location: Budapest, Hungary
Post: #1
The patch was merged on 24 Feb 2012 into master.

Dear All,

I just submitted a patch which enables setting global AV delay. Some displays have complex video processing and can introduce a noticeable delay in video. This functionality can be used to compensate for this within XBMC. The patch enables specifying different delays based on display refresh rate. It can also be used for working around the infamous 24p 250 msec audio delay bug (or whatever it is Smile ).

Global delay is set in advancedsettings.xml. A sample describing supported options is here:

Code:
<advancedsettings>
  <video>

    <!-- Compensate display latency (video lag). Latency is given in msecs. -->
    <latency>

      <!-- Global default display latency -->
      <delay>0</delay>

      <!--
        Override latency for given display (not video) refresh rates.
        When XBMC is in windowed mode, override is ignored. Multiple
        overrides are allowed.

        Syntax of an override entry:
          <refresh>
            <min>, <max> refresh rate range, OR
            <rate> exact refresh rate
            <delay> display latency for the given refresh rate
          </refresh>
       -->

      <!-- Example: display has 125 msec latency at 23-24 Hz -->
      <refresh>
        <min>23</min>
        <max>24</max>
        <delay>125</delay>
      </refresh>

      <!-- Example: display has 50 msec latency at 50 (+/-0.01) Hz -->
      <refresh>
        <rate>50</rate>
        <delay>50</delay>
      </refresh>

    </latency>

  </video>
</advancedsettings>
When XBMC is running in windowed mode, only the default global AV delay is evaluated. Settings in <refresh> tags are ignored. (Fake fullscreen is treated like true fullscreen mode and everything should work.)
(This post was last modified: 2012-02-25 16:06 by a11599.)
find quote
KennethC Offline
Donor
Posts: 61
Joined: Dec 2010
Reputation: 1
Post: #2
This is awesome and it would be very helpful if this got into an upcoming release.
find quote
jmarshall Offline
Team-XBMC Developer
Posts: 25,689
Joined: Oct 2003
Reputation: 169
Post: #3
I believe the delay has been taken care of in the AE branch, so once that's merged it may not be needed?

Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.


[Image: badge.gif]
find quote
KennethC Offline
Donor
Posts: 61
Joined: Dec 2010
Reputation: 1
Post: #4
jmarshall Wrote:I believe the delay has been taken care of in the AE branch, so once that's merged it may not be needed?

Is the new AE going to be merged in the next release, or that still an unknown at this point?
find quote
a11599 Offline
Team-XBMC Member
Posts: 298
Joined: Sep 2010
Reputation: 3
Location: Budapest, Hungary
Post: #5
jmarshall Wrote:I believe the delay has been taken care of in the AE branch, so once that's merged it may not be needed?

Well, hopefully the 250 ms issue will be solved finally by merging AE (I personally have not tested the AE branch), but the intention of the patch was originally not to fix that issue (it just can be used for that as well as a workaround), but to provide some way to define audio shift for people with "lagging" displays who have no other way to do it (for example because their receiver does not provide such a functionality).
find quote
sonic00 Offline
Senior Member
Posts: 159
Joined: Feb 2010
Reputation: 0
Post: #6
Hi there.

I have a -300 delay, if I play 24p files.

I tried all "A/V sync methods" in xbmc - settings - videos - playback, but nothing changed - the delay is still there.

So I found this thread and tried the patch. But I guess I missed something.

I already have a working advancedsettings.xml. I copied the code and paste it in my advancedsettings.xml (changed the delay to -300).

But nothing happend. The delay is also with this patch still there. I can change the delay to -3000 or +3000, its always the same. So I guess I forget something, but what?

At the moment I can change the delay over the OSD, but thats awful, cause I have to do it for all my 24p movies.

Any tipps? Do I have to make some other changes in the xbmc settings??
find quote
a11599 Offline
Team-XBMC Member
Posts: 298
Joined: Sep 2010
Reputation: 3
Location: Budapest, Hungary
Post: #7
Please post your current advancedsettings.xml.
find quote
sonic00 Offline
Senior Member
Posts: 159
Joined: Feb 2010
Reputation: 0
Post: #8
I am right, that I have to bulid a complete new xbmc version, where first I have to patch some files? If so, thats what I missed Wink

I thought, I just have to change the advancesettings.xml.

Code:
<advancedsettings>

  <video>
    <!-- Settings to configure global AV (audio) delay. Some displays have complex video processing -->
    <!-- and can introduce a noticeable delay in video. -->

    <globalavdelay>
    
      <!-- Default global AV delay. If not specified, default is 0. -->
      
      <delay>20</delay>

      <!-- AV delay may depend on display refresh rate (not movie fps!). -->
      
      <refresh>
        <min>23</min>             <!-- Define a range between 23-24 Hz -->
        <max>24</max>
        <delay>-300</delay>       <!-- Workaround for the infamous 24p 250 msec audio delay bug -->
      </refresh>
      
      <refresh>
        <rate>60</rate>           <!-- This matches 60 +- 0.01 Hz -->
        <delay>80</delay>         <!-- Compensate for video processing -->
      </refresh>
      
    </globalavdelay>
  </video>

  <useddsfanart>true</useddsfanart>

  <restrictcapsmask>4</restrictcapsmask>

  <videolibrary>
      <hideallitems>true</hideallitems>
      <cleanonupdate>true</cleanonupdate>
  </videolibrary>

  <musiclibrary>
      <hideallitems>true</hideallitems>
  </musiclibrary>

</advancedsettings>
(This post was last modified: 2011-03-27 19:35 by sonic00.)
find quote
a11599 Offline
Team-XBMC Member
Posts: 298
Joined: Sep 2010
Reputation: 3
Location: Budapest, Hungary
Post: #9
Yep, you have to build your own version to use this patch. Smile
find quote
ashlar Offline
Donor
Posts: 2,093
Joined: Mar 2006
Reputation: 27
Post: #10
Considering the all around usefulness of this (ie. for people with no AV receivers capable of setting delays), any chance for this to be merged? It definitely seems to go beyond AE.

Although, thinking about it, it might well be that AE will change pretty much everything this is coded for.

For troubleshooting and bug reporting please make sure you read this first.
find quote
jmarshall Offline
Team-XBMC Developer
Posts: 25,689
Joined: Oct 2003
Reputation: 169
Post: #11
Yeah, which is why we're holding off. AE is getting reasonably close to the point where it can be slotted in to master now.

Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.


[Image: badge.gif]
find quote
ashlar Offline
Donor
Posts: 2,093
Joined: Mar 2006
Reputation: 27
Post: #12
jmarshall Wrote:Yeah, which is why we're holding off. AE is getting reasonably close to the point where it can be slotted in to master now.
Right. Smile
Thanks for the clarification.

For troubleshooting and bug reporting please make sure you read this first.
find quote
Krautmaster Offline
Senior Member
Posts: 204
Joined: Jul 2010
Reputation: 1
Post: #13
damn... i dont find out how to apply this patch.
My 55LX9500 produces a lag of 50-100 ms with post processing. My old pioneer can't compensate this dealy =/

I want to apply this diff. Does anybody have the commands for me. I checked out xbmc Dharma using git. Whats next?

Thanks a lot!!

Edit: Cant be patched to the normal Dharma-PVR release or? AdvancedSettings.cpp and h is missing there
(This post was last modified: 2011-04-29 11:07 by Krautmaster.)
find quote
sonic00 Offline
Senior Member
Posts: 159
Joined: Feb 2010
Reputation: 0
Post: #14
Hi,

I'm using that patch for Dharma 10.1. So, in the near future, Dharma will replace by Eden, but what happend with that patch? Is it already integrated in Eden, or do we need a new patch for it?

I ask because I definitely need that kind of patch do adjust the audio delay for my TV. Will that be possible in Eden?
(This post was last modified: 2011-10-02 01:52 by sonic00.)
find quote
Kalliban Offline
Member
Posts: 59
Joined: Dec 2010
Reputation: 0
Post: #15
I'm also wondering this. Since the audio engine has been postponed, this patch would be able to treat the symptoms.. Nod
find quote
Post Reply