FORUMS: list search recent posts

Script to trim Selected Video Layers to the length of its audio

COW Forums : Adobe After Effects

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Rafat Rifaie
Script to trim Selected Video Layers to the length of its audio
on Nov 3, 2017 at 6:40:39 pm

I have 50+ layers. Each layer is a separate video clip with audio. All layers have different lengths, and the audio in each layer ends before the its video does [there's a still image placed after the audio is over for a random amount of time **Random(that's the problem)]. I basically want to trim all the unnecessary still footage of each layer, matching the layer's length to its audio's. The audio stops, the layer ends. Is this possible to do, and how?


Return to posts index

Dave LaRonde
Re: Script to trim Selected Video Layers to the length of its audio
on Nov 3, 2017 at 8:09:38 pm

Scrub to the end of the audio. Hit the alt-] (opt-] mac) key to set the layer's new out point.
If it takes you more than 10 minutes to do all 50 layers, you're doing something wrong.

Dave LaRonde
Promotion Producer
KGAN (CBS) & KFXA (Fox) Cedar Rapids, IA


Return to posts index

Rafat Rifaie
Re: Script to trim Selected Video Layers to the length of its audio
on Nov 3, 2017 at 8:38:29 pm

Thanks for the reply dave, but this is actually a bit tedious
  • Select Layer
  • Click to unfold layer's properties
  • Click to unfold audio properties
  • Click to unfold audio's waveform
  • Scrub to the end of the waveform
  • Press ctrl ]
  • Scroll down to be able to see next layer
  • Repeat

If this is a one time job, i would tame my impatience for a bit, but it would drive me crazy when i get the next batch of videos to process lol.
On another note, while looking through the extendscript guide, i found this method "app.project.item(i).layer(i).audioActiveAtTime(time)"
which is a good starting point. I'm thinking to loop through all the layers i want to trim, and with a nested for loop [i = layersLength; i > 0; i--] that decrements the time by 1 sec call the audioActiveAtTime method, until i get a false, then record that time and trim the layer to it.
Hopefully this all works out when i'm out of work tomorrow.


Return to posts index


Dave LaRonde
Re: Script to trim Selected Video Layers to the length of its audio
on Nov 3, 2017 at 8:55:44 pm
Last Edited By Dave LaRonde on Nov 3, 2017 at 9:27:04 pm

[Rafat Rifaie] "Select Layer
Click to unfold layer's properties
Click to unfold audio properties
Click to unfold audio's waveform
Scrub to the end of the waveform"


Yup, you would be doing it wrong.
  • Highlight the layer
  • Hit "ll" -- two lower-case L's in quick succession -- to reveal ONLY the audio waveform
  • Go to the point where you see the audio end
  • Scrub to fine-tune

Then you do everything else.

I maintain that you can do all 50 layers in FAR less time than it would take you to figure out an automatic way to do it.

Dave LaRonde
Promotion Producer
KGAN (CBS) & KFXA (Fox) Cedar Rapids, IA


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2017 CreativeCOW.net All Rights Reserved
[TOP]