LIBRARY: Tutorials Reviews Interviews Editorials Features Business Authors RSS Feed

Synchronizing Video to Audio with Layer Markers and Expression Sets

COW Library : Adobe After Effects Tutorials : Joel Hooton : Synchronizing Video to Audio with Layer Markers and Expression Sets
Synchronizing Video to Audio with Layer Markers and Expression Sets
CreativeCOW.net Adobe After Effects Tutorial

 

Sychronizing Video to Audio with Layer Markers and Expression Sets

 

   

Joel Hooton
Detroit , Michigan , USA

©2005 by Joel Hooton and CreativeCow.net. All rights are reserved.

 

Article Focus:

A while back, Dan Ebberts made an article talking about synchronizing animation to audio using layer markers.  It was really cool and easy to setup.  Make a comp add the expression to an attribute and just click away on the * key on the num pad to sync video to audio. In this article, Joel Hooton wanted to see how many different useful sets of expressions he could develop that make use of this great feature.  We'll also see how they are used together to make more complex outputs.

 

 

AE file (5.5) zip                            movie               excel file


Introduction


There have been several times in the past where I wanted to sync audio and video together but did not know how.  Key framing was not the answer (too cumbersome and LOOOOOONG).  Trapcode Soundkeys works well; however, sometimes I want to have movement at specific words or notes that Soundkeys did not pick up consistently.  Plus it is not free.  Then I saw a little expression Dan Ebberts setup for someone that used layer markers to trigger a timeremap.  I looked at this expression and was amazed at how simple it was.  So I decided to rip it apart and figure out how to do other things with it.

Other people out there might already have this stuff done but I thought that since I did it and people sometimes have these questions, I might as well put it all together for everyone.  When I started compiling all of the different expressions, I wanted to cover as much ground as possible and make many different expression sets.  Yes some of these are very similar and might not be useful to everyone but I wanted to cover as much as possible.  Some expression sets have a value from 0 to 1 between markers while others step by one at each marker.  By adding, subtracting, multiplying and dividing the different sets together you can get many different outputs (we will some of this later).

Objective


First of all I am not a programmer.  I repeat I am not a programmer.  This article is not to show that I found the best way to code these expressions.  It is to let others see how easy and versatile the layer markers can be in syncing video to audio.  Hopefully that after seeing the information below, you can better understand why the code works so you can better decide how you can best use it for yourself.

 

The different code arrangements


I have setup 10 different code variations using layer makers to trigger the expressions.  Some of these are very similar but they give a better overall view of the possibilities available.

 

(1) Ramp Up Reset [between Markers]

            The code below starts increasing from zero at the first marker and continues to increase to a value of 1 at the next marker.  The distance between the markers determines the speed to the increase and the value never goes higher than 1. Repeat and Reset at next marker. 

(There MUST be a layer marker at past the end of the layer for this expression to work, see AE file)

 

if (marker.num_keys > 0){

  m = marker.nearest_key(time).index;

  if (marker.key(m).time <= time){

    (1/(marker.key(m+1).time-marker.key(m).time))*(time-marker.key(m+1).time)+1

  }else if (m != 1){

    (1/(marker.key(m).time-marker.key(m-1).time))*(time-marker.key(m).time)+1

  }else{

    0

  }

}else{

  0

} 

 

 


The red dots represent layer markers. 


=======================================================================================

 

(2) Ramp Down Reset [between Markers]

            The code below starts decreasing from 1 at the first marker and continues to decrease to a value of 0 at the next marker.  The distance between the markers determines the speed to the decrease and the value never goes higher than 1. Resets and Repeats at next marker.

(There MUST be a layer marker at past the end of the layer for this expression to work, see AE file).

 

if (marker.num_keys > 0){

  m = marker.nearest_key(time).index;

  if (marker.key(m).time <= time){

    (-1/(marker.key(m+1).time-marker.key(m).time))*(time-marker.key(m+1).time)

  }else if (m != 1){

    (-1/(marker.key(m).time-marker.key(m-1).time))*(time-marker.key(m).time)

  }else{

    0

  }

}else{

  0

} 

 



The red dots represent layer markers. 

 

=======================================================================================

 

(3) Ramp Down Reset [1 sec]

The code below starts decreasing from 1 at the first marker and continues to decrease to a value of 0 in 1 sec.  The distance between the markers is not important and the value never goes higher than 1. Resets and Repeats at next marker.

 

if (marker.num_keys > 0){

  m = marker.nearest_key(time).index;

  x=m%2;

 if (time-marker.key(m).time<1&&time>=marker.key(m).time){

    1-(time-marker.key(m).time)

 }else if (marker.key(m).index==1){

    0

 }else if(time-marker.key(m-1).time<1&&time>=marker.key(m-1).time){

    1-(time-marker.key(m-1).time)

 }else{

    0

  }

}else{

0

}

} 

The red dots represent layer markers. 

 

=======================================================================================

 

(4) Ramp Up Reset

The code below starts increasing from 0 at the first marker and continues to increase till the next marker.  The distance between the markers determines the value. The final value is equal to the time distance between the markers.  Resets and Repeats at next marker.  (This is the expression that I found from Dan Ebberts.  Thanks again)

 

if (marker.num_keys > 0){

  m = marker.nearest_key(time).index;

  if (marker.key(m).time <= time){

     time-marker.key(m).time

  }else if (m != 1){

    time -marker.key(m - 1).time

  }else{

    0

  }

}else{

  0

} 

 



The red dots represent layer markers. 

 

=======================================================================================

 

(5) Ramp Up Reset [On/Off]

The code below starts increasing from 0 at the first marker and continues to increase till the next marker.  The distance between the markers determines the value. The final value is equal to the time distance between the markers. 

Turns off at every EVEN marker then Resets and Repeats at next ODD marker.

 

if (marker.num_keys > 0){

  m = marker.nearest_key(time).index;

  x=m%2;

  if ( marker.key(m).time <= time && x==1){

    time-marker.key(m).time

  }else if (marker.key(m).time>time && x==0){

    time -marker.key(m - 1).time

  }else{

    0

  }

}else{

  0

} 

 



The red dots represent layer markers. 

 

=======================================================================================

 

(6) Ramp Up/Down Reset

The code below starts increasing from 0 at the first marker and continues to increase till halfway to the next marker.  Then the value decreases to 0 at the next marker.  The distance between the markers determines the maximum value.  Resets and Repeats at next marker.

 

 

if (marker.num_keys > 0){

  m = marker.nearest_key(time).index;

  if (marker.key(m).time <= time){

     time-marker.key(m).time

  }else if (m != 1){

   marker.key(m).time-time

  }else{

    0

  }

}else{

  0

} 

 


The red dots represent layer markers. 

 

=======================================================================================

 

(7) Step Up

The code below starts with a value of 1 at the first marker and continues to increase by 1 at each additional marker.  The total number of markers determines the maximum value. 

 

 

if (marker.num_keys > 0){

  m = marker.nearest_key(time).index;

  if (marker.key(m).time <= time){

     marker.key(m).index

  }else if (m != 1){

    marker.key(m - 1).index

  }else{

    0

  }

}else{

  0

} 

 


The red dots represent layer markers. 

 

=======================================================================================

 

(8) Step Up [On/Off]

The code below starts with a value of 1 at the first marker.  It turns off at every EVEN marker and increases by 1 at every ODD marker.  The total number of markers determines the maximum value.

The markers below indicate when the picture to the right switches.

 

if (marker.num_keys > 0){

   m = marker.nearest_key(time).index;

   x=m%2;

  if ( marker.key(m).time <= time && x==1){

     if( marker.key(m).index ==1){

       marker.key(m).index

    }else{

       marker.key((0.5*m)+.5).index

    }

  }else if (marker.key(m).time>time && x==0){

    if( marker.key(m).index==2){

      marker.key(m-1).index

    }else{

      marker.key(m/2).index

    }

  }else{

    0

   }

 }else{

  0

} 


 

The red dots represent layer markers. 

 

=======================================================================================

 

(9) Flat [+/- switch]

The code below starts with a value of +1 at the first marker.  It turns to -1 at every EVEN marker and +1 at every ODD marker.   Just basically a flip/flop expression. Values between +1/-1.

 

if (marker.num_keys > 0){

   m = marker.nearest_key(time).index;

   x=m%2;

  if ( marker.key(m).time <= time && x==1){

     1

  }else if (marker.key(m).time>time && x==0){

     1

 }else if (marker.key(1).time>time && x==1){

     0

  }else if (marker.key(m).time>time && x==1){

     -1

  }else{

    -1

  }

 }else{

  0

} 


The red dots represent layer markers. 

 

======================================================================================

 

(10) Flat

The code below starts with a value of 1 at the first marker.  It turns off at every EVEN marker and back to 1 at every ODD marker. Values between +1/0 

 

if (marker.num_keys > 0){

   m = marker.nearest_key(time).index;

   x=m%2;

  if ( marker.key(m).time <= time && x==1){

     1

  }else if (marker.key(m).time>time && x==0){

     1

  }else{

    0

  }

 }else{

  0

} 



The red dots represent layer markers. 

 

Combining the Sets

Now that the expression sets have been explained individually, combining them together can give many more complex forms possibly to cumbersome to type out in an individual expression.

 I expression set (1) is multiplied by itself and then by 100, the final graph looks like this.  This gives a second degree polynomial function that starts at zero and ends at 100.  Apply this to a layer’s opacity.  Now instead of the linear increase from zero to 1 (the standard code for set 1) the combination returns a much complex range of values based on the layer markers.

 


The red dots represent layer markers. 


 

Conclusion

I hope that this has been helpful to someone out there.  I really enjoyed setting it up and learning as I went.  The movie I made is just a quick example of how these expressions can be used.  I used no key framing in the animation of these effects.  I did manually position the layers, but all movement, opacity changes, color changes and pattern shifts were all controlled by the layer markers for each effect. 

The included excel file has the above 10 sets of expressions listed in tabular form.  You can pick and choose which sets to add, subtract, multiply and divide.  The chart in the file shows the two initial sets and the one produced after the combination.  It is useful for seeing how interactions occur. Thanks for reading.

Feel free to post your question on the Adobe After Effects Forum at CreativeCOW.net.


If you found this page from a direct link, please visit our forums or read other articles at CreativeCOW.net



Related Articles / Tutorials:
Adobe After Effects
Adobe After Effects: Common QT & Export Problems & Solutions

Adobe After Effects: Common QT & Export Problems & Solutions

Problems with Adobe After Effects? Can't import or export QuickTime videos? Exports too big? Missing codecs? AE guru and VFX whiz Tobias Gleissenberger of Surfaced Studio has the answers you're looking for to make every project come to completion more smoothly, including a comparison of exported file sizes for common codecs.

Tutorial
Tobias Gleissenberger
Adobe After Effects
Fancy Title Animations In Adobe After Effects -- FAST!

Fancy Title Animations In Adobe After Effects -- FAST!

Follow along as VFX guru Tobias Gleissenberger shows you how how to quickly create professional-looking animated text elements using the free presets that are included with Adobe After Effects, customizing them to suit your needs. Tobias will also show you how to apply masks to your text layers to have them appear from behind other elements.

Tutorial
Tobias Gleissenberger
Adobe After Effects
Remove People from Moving Video in After Effects with Mocha

Remove People from Moving Video in After Effects with Mocha

Learn how to remove a person from a moving video using the Remove module of the Mocha Pro plug-in for Adobe After Effects! In one of his most epic tutorial's yet, Surfaced Studio's Tobias Gleissenberger then adds a bonus Beam Up effect using some of the great filters from the Boris Continuum and Sapphire collections.

Tutorial
Tobias Gleissenberger
Adobe After Effects
Basic Clone Effect Interaction - After Effects Tutorial

Basic Clone Effect Interaction - After Effects Tutorial

Want to take your CLONE EFFECT to the next level? Want to know how to make your clones INTERACT? Tobias Gleissenberger shows you how.

Tutorial
Tobias Gleissenberger
Adobe After Effects
Adobe After Effects: Glitch Effects Without Using Plug-ins!

Adobe After Effects: Glitch Effects Without Using Plug-ins!

Join VFX guru Tobias Gleissenberger for a fun, high-energy look at how to create all sorts of digital noise, glitch, and other disturbing video effects with any version of Adobe After Effects, without using any plug-ins!

Tutorial
Tobias Gleissenberger
Adobe After Effects
Adobe After Effects Energy Ball

Adobe After Effects Energy Ball

In his latest high-energy Adobe After Effects tutorial, VFX guru Tobias Gleissenberger of Surfaced Studio combines a variety of effects to create the pulsating energy ball, composited with motion tracking, optical flares, and more.

Tutorial
Tobias Gleissenberger
Adobe After Effects
Stabilize 360 Video with Mocha VR

Stabilize 360 Video with Mocha VR

In this intermediate tutorial, Mocha Product Manager Martin Brennand takes you through smoothing the horizon in a Samsung Gear 360 shot using the Reorient Module in Mocha VR. Jittery 360 video footage can be made more watchable by stabilizing with Mocha’s planar tracking tools. The tutorial is done via the Adobe After Effects plug-in, but the techniques apply to all versions of Mocha VR.

Tutorial
Imagineer Systems
Adobe After Effects
Adobe After Effects April 2017 New Features

Adobe After Effects April 2017 New Features

The April 2017 release of Adobe After Effects (version 14.2) is packed with new features, and Tobias Gleissenberger of Surfaced Studio is here to show you the latest and greatest. Highlights include the Essential Graphics panel and Motion Graphics templates (with Adobe Premiere Pro integration), the addition of Lumetri Scopes and Color Correction effects, new effects organization, the Camera Shake Deblur filter and more.

Tutorial
Tobias Gleissenberger
Adobe After Effects
Adobe After Effects Advanced Title Tutorial

Adobe After Effects Advanced Title Tutorial

Learn how to create complex title animations in Adobe After Effects! In my last tutorial I covered how to create, customise and animate simple titles in Adobe Premiere Pro: https://www.youtube.com/watch?v=6xQtq... In this tutorial we will take things one step further and create titles that are too complex to create with Premiere alone. We will be working with and customising presets, creating character by character animations and we will look at the power of custom Text Animators. Want to learn more about how to animate text? Check out the Adobe help page: https://helpx.adobe.com/after-effects...

Tutorial
Tobias Gleissenberger
Adobe After Effects
Imagineer mocha Pro 5 Plug-In for Adobe: An In Depth Review

Imagineer mocha Pro 5 Plug-In for Adobe: An In Depth Review

Imagineer mocha Pro 5 Plug-in for Adobe brings all the amazing features of the professional version of the mocha Planar Tracker directly into After Effects and Premiere Pro in the form of a plugin. In this in-depth review, After Effects tutorial guru Tobias Gleissenberger of Surfaced Studio will show you what you can do with this new plug-in, and discuss what he likes and doesn't like about the new update.

Tutorial
Tobias Gleissenberger
MORE
© 2018 CreativeCOW.net All Rights Reserved
[TOP]