9 Replies Latest reply on Nov 21, 2015 9:53 AM by whatshouldmyusernamebe

    Footage Speed Up Corresponding With Audio!

    whatshouldmyusernamebe

      I know that it is possible to make a logo shake or pulse as the audio in the background exceeds a certain level. Is it possible for footage to speed up after the audio exceeds a certain level. So my project is footage of flying through clouds, and I have music playing in the background, I need the footage to speed up after the audio exceeds the level I want it to. Is that possible?

        • 1. Re: Footage Speed Up Corresponding With Audio!
          Rick Gerard Adobe Community Professional & MVP

          Yes. You should do some research on time remapping.  It's easiest to do manually. Writing an expression that automate the process would require a deep understanding of After Effects expression language.

          • 2. Re: Footage Speed Up Corresponding With Audio!
            whatshouldmyusernamebe Level 1

            Yeah, I know how to time remap, but I was wondering if there was an expression that anyone happened to know. I've seen it be done before. Also, do you know a way I could keyframe it using some sort of audio amplitude, and pair the speed to the amplitude?

            • 3. Re: Footage Speed Up Corresponding With Audio!
              Szalam Adobe Community Professional & MVP

              whatshouldmyusernamebe wrote:

               

              Also, do you know a way I could keyframe it using some sort of audio amplitude, and pair the speed to the amplitude?

              Yes. That would be the expressions that Rick Gerard referenced. You could use Sound Keys (or AE's built-in tool to generate keyframes from audio) and then use expressions to tie your time remapping to the resulting keyframes.

              • 4. Re: Footage Speed Up Corresponding With Audio!
                whatshouldmyusernamebe Level 1

                I'm having trouble figuring out how to tie them, it isn't like pairing. It must be something else. Any idea?

                • 5. Re: Footage Speed Up Corresponding With Audio!
                  Szalam Adobe Community Professional & MVP

                  You would have to have some sort of expression that reads

                   

                  time*x

                  where x is your volume keyframes multiplied or divided by whatever number gets you the result you want. You may even need to use the amplitude values in some sort of linear() expression to get values that make sense.

                  • 6. Re: Footage Speed Up Corresponding With Audio!
                    whatshouldmyusernamebe Level 1

                    How could I write this expression? Say the name of my music is "123" would I do time*123? And where would this expression go? I've tried doing time remapping and then command shift = but that doesn't work.

                    • 7. Re: Footage Speed Up Corresponding With Audio!
                      Rick Gerard Adobe Community Professional & MVP

                      Writing expressions that speed up and slow down time remapping is quite complicated. When you enable time remapping you get two keyframes, one at the start of the layer and the other at the end. You can then remove the keyframe at the end which essentially freezes the video or animation at the first frame. You then add an expression like this and the video will play at half speed:

                      time * 2

                       

                      To play at double speed you would change the expression to time *.5

                       

                      The complexity comes when you want to ramp up from normal speed (time * 1) to four times speed (time * .25) because the math and the calculations get very awkward. Dan Ebberts, the dean of expressions, has an excellent article on his website that will point you in the right direction. Find it here: Expression Speed and Frequency Control

                       

                      At the bottom of the article is an example that uses audio to speed up and slow down a clip using this expression and the Audio to Keyframes keyframe assistant:

                      spd = thisComp.layer("Audio Amplitude").effect("Both Channels")("Slider");

                      mult = .5;

                      n = spd.numKeys;

                      if (n > 0 && spd.key(1).time < time){

                        accum = spd.key(1).value*(spd.key(1).time - inPoint);

                        for (i = 2; i <= n; i++){

                          if (spd.key(i).time > time) break;

                          k1 = spd.key(i-1);

                          k2 = spd.key(i);

                          accum += (k1.value + k2.value)*(k2.time - k1.time)/2;

                        }

                        accum += (spd.value + spd.key(i-1).value)*(time - spd.key(i-1).time)/2;

                      }else{

                        accum = spd.value*(time - inPoint);

                      }

                      value + accum*mult

                      This would be a good starting point. You would add your own slider and replace the Audio Amplitude layer in the first line, then keyframe the speed changes.

                       

                      Here's one more thing that will make the whole process easier if you have trimmed your video clip in the comp. If you enable time remapping the keyframes will be placed at the head and tail of the clip, not the in and out point. If you choose Layer>Time>Freeze Frame you'll get a keyframe under the CTI. This makes things a lot easier to work with. You'll probably also want to set your composition's start timecode to 0

                      • 8. Re: Footage Speed Up Corresponding With Audio!
                        whatshouldmyusernamebe Level 1

                        Where would I insert the expression

                        spd = thisComp.layer("Audio Amplitude").effect("Both Channels")("Slider");

                        mult = .5;

                        n = spd.numKeys;

                        if (n > 0 && spd.key(1).time < time){

                          accum = spd.key(1).value*(spd.key(1).time - inPoint);

                          for (i = 2; i <= n; i++){

                            if (spd.key(i).time > time) break;

                            k1 = spd.key(i-1);

                            k2 = spd.key(i);

                            accum += (k1.value + k2.value)*(k2.time - k1.time)/2;

                          }

                          accum += (spd.value + spd.key(i-1).value)*(time - spd.key(i-1).time)/2;

                        }else{

                          accum = spd.value*(time - inPoint);

                        }

                        value + accum*mult

                        ?

                        • 9. Re: Footage Speed Up Corresponding With Audio!
                          whatshouldmyusernamebe Level 1

                          YES, IT WORKS THANKS SO MUCH!!!