Let’s say that you have an After Effects template that you want to dynamically expand and contract the timeline duration based not just on the duration of the video clips, but also having the number of video clips in the timeline change from video to video.
Note: this technique will create a 1-frame overlap between your clips
In this example, we’re going to set up a Main timeline, and we will set things up to have a maximum of 3 precomped video “slides” that we will be injecting video clips into. For this example, we are going to assume that you want to play each clip for its entire duration, but the same principles can be applied to clips with various shift, trim, and stretch Time Sculpting parameters.
First, import a piece of video footage-- this is just a temporary placeholder (don’t use an AE placeholder layer, though). Create 3 (or how ever many you need) precomps, each with the placeholder footage added to the timeline, and apply the Templater Settings effect to each of the layers. Be sure to rename them to match your column names in your data source (in my example I named them “first,” second," and “third”). For each footage layer you’ll want to set your “Time” parameters to “Comp starts at in point” and “Comp ends at out point” and your “Trim” parameters to “Preserve start” and “Preserve end” so that the entirety of the clip plays and that the duration of the precomp is the exactly the same as the duration of the clip it contains.
For each precomped “slide” in the main timeline, you will also apply the Templater Settings effect, and each will have the various Time Sculpting controls set as follows (note the “shift” parameter with the 1 frame shift overlap on every clip after the first one):
The last piece of the puzzle is to use a 2-frame long transparent (100% alpha) video clip that is exactly double the framerate of the slide precomps that you will call in your datasource when you want to turn a specific slide off for a particular render. The clip needs to be 2 frames because a video clip that is 1 frame long will be recognized as a still by AE/Templater, and it won’t properly adjust your precomp durations. The clip itself can be extremely small, dimensionally (say, 4px x4px). In my example, “blank-slide.mov” is the 2-frame transparent clip.
If you have any questions, feel free to ask here, or shoot us an email.
Download dynamic slides example project
[this thread has been updated to incorporate the framerate advice from Maris, a few posts below]