<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="http://avisynth.nl/skins/common/feed.css?303"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>http://avisynth.nl/index.php?action=history&amp;feed=atom&amp;title=FindAudioSyncScript</id>
		<title>FindAudioSyncScript - Revision history</title>
		<link rel="self" type="application/atom+xml" href="http://avisynth.nl/index.php?action=history&amp;feed=atom&amp;title=FindAudioSyncScript"/>
		<link rel="alternate" type="text/html" href="http://avisynth.nl/index.php?title=FindAudioSyncScript&amp;action=history"/>
		<updated>2026-04-07T17:35:47Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.19.24</generator>

	<entry>
		<id>http://avisynth.nl/index.php?title=FindAudioSyncScript&amp;diff=1396&amp;oldid=prev</id>
		<title>Admin: 1 revision</title>
		<link rel="alternate" type="text/html" href="http://avisynth.nl/index.php?title=FindAudioSyncScript&amp;diff=1396&amp;oldid=prev"/>
				<updated>2013-05-19T22:03:50Z</updated>
		
		<summary type="html">&lt;p&gt;1 revision&lt;/p&gt;
&lt;table class='diff diff-contentalign-left'&gt;
			&lt;tr valign='top'&gt;
			&lt;td colspan='1' style=&quot;background-color: white; color:black;&quot;&gt;← Older revision&lt;/td&gt;
			&lt;td colspan='1' style=&quot;background-color: white; color:black;&quot;&gt;Revision as of 22:03, 19 May 2013&lt;/td&gt;
			&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>Admin</name></author>	</entry>

	<entry>
		<id>http://avisynth.nl/index.php?title=FindAudioSyncScript&amp;diff=1395&amp;oldid=prev</id>
		<title>Wilbert at 22:00, 19 May 2013</title>
		<link rel="alternate" type="text/html" href="http://avisynth.nl/index.php?title=FindAudioSyncScript&amp;diff=1395&amp;oldid=prev"/>
				<updated>2013-05-19T22:00:46Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class='diff diff-contentalign-left'&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
			&lt;tr valign='top'&gt;
			&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;← Older revision&lt;/td&gt;
			&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;Revision as of 22:00, 19 May 2013&lt;/td&gt;
			&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;{{FilterCat|External_filters|Audio_filters|Audio_filters}}&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;I would like to share this script as an approach to finding the appropriate [[DelayAudio]] value to use to correct lip sync errors in video material.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;I would like to share this script as an approach to finding the appropriate [[DelayAudio]] value to use to correct lip sync errors in video material.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 59:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 60:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160;  Delay = (Delay * Scale) + Offset&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160;  Delay = (Delay * Scale) + Offset&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160;  Return DelayAudio(Clip, Delay).Subtitle(&amp;quot;Delay &amp;quot; + String(Delay)).FadeIO(6)&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160;  Return DelayAudio(Clip, Delay).Subtitle(&amp;quot;Delay &amp;quot; + String(Delay)).FadeIO(6)&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160; } &amp;#160;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160; }&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;[[Category:Shared functions]]&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Wilbert</name></author>	</entry>

	<entry>
		<id>http://avisynth.nl/index.php?title=FindAudioSyncScript&amp;diff=948&amp;oldid=prev</id>
		<title>Admin: 1 revision</title>
		<link rel="alternate" type="text/html" href="http://avisynth.nl/index.php?title=FindAudioSyncScript&amp;diff=948&amp;oldid=prev"/>
				<updated>2013-05-09T21:34:45Z</updated>
		
		<summary type="html">&lt;p&gt;1 revision&lt;/p&gt;
&lt;table class='diff diff-contentalign-left'&gt;
			&lt;tr valign='top'&gt;
			&lt;td colspan='1' style=&quot;background-color: white; color:black;&quot;&gt;← Older revision&lt;/td&gt;
			&lt;td colspan='1' style=&quot;background-color: white; color:black;&quot;&gt;Revision as of 21:34, 9 May 2013&lt;/td&gt;
			&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>Admin</name></author>	</entry>

	<entry>
		<id>http://avisynth.nl/index.php?title=FindAudioSyncScript&amp;diff=947&amp;oldid=prev</id>
		<title>Laur: Shared functions/FindAudioSyncScript moved to FindAudioSyncScript: Remove obsolete shared functions category. See Talk:External filters.</title>
		<link rel="alternate" type="text/html" href="http://avisynth.nl/index.php?title=FindAudioSyncScript&amp;diff=947&amp;oldid=prev"/>
				<updated>2009-08-18T14:54:38Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;a href=&quot;/index.php?title=Shared_functions/FindAudioSyncScript&amp;amp;action=edit&amp;amp;redlink=1&quot; class=&quot;new&quot; title=&quot;Shared functions/FindAudioSyncScript (page does not exist)&quot;&gt;Shared functions/FindAudioSyncScript&lt;/a&gt; moved to &lt;a href=&quot;/index.php/FindAudioSyncScript&quot; title=&quot;FindAudioSyncScript&quot;&gt;FindAudioSyncScript&lt;/a&gt;: Remove obsolete shared functions category. See Talk:External filters.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;I would like to share this script as an approach to finding the appropriate [[DelayAudio]] value to use to correct lip sync errors in video material.&lt;br /&gt;
&lt;br /&gt;
It has always been a pain trying to find the right delay offset by simply tweaking the delay and watching the results over and over, I can never quite find the right value before frustration takes hold.&lt;br /&gt;
&lt;br /&gt;
The script below takes a short section of an input video which has some recognizable sharp sound and its matching visual event. For an interlaced source I Bob deinterlace it to double the video temporal resolution and also take the free ride to resize at this point. I then have a function to return the clip with a specified DelayAudio value and a subtitle identifying the delay used. I was finding that I was getting used to the delayed audio and could no longer discern the best sequence, I found adding a [[FadeIO]] helped the mind reset its zero reference between samples. I generate a series of these clips and [[AlignedSplice]] them all together. At the end of the process I then slow everything down using [[AssumeFPS]] based on reclocking the audio to 8Khz.&lt;br /&gt;
&lt;br /&gt;
Sample Script&lt;br /&gt;
&lt;br /&gt;
 #&lt;br /&gt;
 # Generate 11 variations of an input clip with varying audio delays&lt;br /&gt;
 #&lt;br /&gt;
 # Seperate into fields to double video temporal resolution&lt;br /&gt;
 # Slow everything down to exagerate the Audio lipsync error&lt;br /&gt;
 #&lt;br /&gt;
 # Iterate the following values to find the optimal AudioDelay setting&lt;br /&gt;
 &lt;br /&gt;
 Global Offset= 0.000 # Middle value of the sweep range being tested&lt;br /&gt;
 Global Scale = 0.250 # Scale the sweep range from +/- 1 second&lt;br /&gt;
 &lt;br /&gt;
 AVISource(&amp;quot;Nemisis.avi&amp;quot;, True, &amp;quot;YUY2&amp;quot;) # Select the input file&lt;br /&gt;
 &lt;br /&gt;
 # ===========&lt;br /&gt;
 &lt;br /&gt;
 AssumeFrameBased() # Correctly describe frame/field attribute&lt;br /&gt;
 AssumeTFF() # Correctly describe field order&lt;br /&gt;
 Trim(6115, -30) # Define the range of frames to investigate&lt;br /&gt;
 Bob(Height=240) # Double the FrameRate, Choose a good height&lt;br /&gt;
 BilinearResize(320, Height()) # Choose a good width&lt;br /&gt;
 &lt;br /&gt;
 #&lt;br /&gt;
 # AlignedSplice each prospective clip sample, specify a range of delays&lt;br /&gt;
 #&lt;br /&gt;
 &lt;br /&gt;
 DoDelayAudio(-1.0) ++ \&lt;br /&gt;
 DoDelayAudio(-0.8) ++ \&lt;br /&gt;
 DoDelayAudio(-0.6) ++ \&lt;br /&gt;
 DoDelayAudio(-0.4) ++ \&lt;br /&gt;
 DoDelayAudio(-0.2) ++ \&lt;br /&gt;
 DoDelayAudio( 0.0) ++ \&lt;br /&gt;
 DoDelayAudio(+0.2) ++ \&lt;br /&gt;
 DoDelayAudio(+0.4) ++ \&lt;br /&gt;
 DoDelayAudio(+0.6) ++ \&lt;br /&gt;
 DoDelayAudio(+0.8) ++ \&lt;br /&gt;
 DoDelayAudio(+1.0)&lt;br /&gt;
 &lt;br /&gt;
 #&lt;br /&gt;
 # Slow everything down, keep Audio and Video synced&lt;br /&gt;
 # Audio will be 8kHz, Video will be slowed to match&lt;br /&gt;
 #&lt;br /&gt;
 &lt;br /&gt;
 AssumeFPS(8000.0 * FrameRate() / AudioRate(), True)&lt;br /&gt;
 &lt;br /&gt;
 #&lt;br /&gt;
 # Adjust the Audio Delay, Add a Subtitle, Fade In/Out&lt;br /&gt;
 #&lt;br /&gt;
 &lt;br /&gt;
 Function DoDelayAudio(Clip Clip, Float Delay)&lt;br /&gt;
 {&lt;br /&gt;
   Delay = (Delay * Scale) + Offset&lt;br /&gt;
   Return DelayAudio(Clip, Delay).Subtitle(&amp;quot;Delay &amp;quot; + String(Delay)).FadeIO(6)&lt;br /&gt;
 } &lt;br /&gt;
&lt;br /&gt;
[[Category:Shared functions]]&lt;/div&gt;</summary>
		<author><name>Laur</name></author>	</entry>

	</feed>