Looping video in full until Audio is complete
-
Hi,
I have video files that range in length from 10-20 seconds. I have audio files that range in length from 10-35 seconds. I’d like to create a comp where the video loops. Once the audio file finishes, the video finishes its current loop, then the comp ends.
I don’t want to end the comp at the end of the audio as it would look awkward if the video cut off halfway (after playing all the way through 1-3 times).
Do you have any recommendations for this? Thanks in advance!
-
@ben-forman This may be possible (or close to it) with some really hacky math-based expressions, but I haven’t been able to figure it out getting it working within a project in the immediate term. The way that the
loopOut()
expression works (requiring two keyframes) interferes with the way that time remapping would need to function in the context of Templater’s Time Sculpting and layer-swapping logic-- using only one Time Remapping keyframe at the beginning of the layer (to accommodate for the unknown variable duration of each video-- if there is a second keyframe, it won’t adapt to the full duration of the source footage). Since you don’t know how many loops may be necessary, that adds another layer of complication, and then there is the circular way that the durations of each will need to reference each other-- it’s pretty intense logic. Using the techniques I’ve tried, you’d either have to choose between playing the full “loop” only once, and you could maybe loop it infinitely for the duration of the layer, but you still run into the issue of setting the out point of the video layer itself, which is not something that expressions can do.This is likely in the realm of writing an ExtendScript function that can look at the source duration of each video, compare it to the duration of the source of the audio, enable time remapping, set the in/out point of each video to
dur x loops
, then set the start and end of the containing comp to match the layer duration of the time-remapped video.Now, it may be that this is the kind of thing that can be hacked together and largely handled through the data. For example, if you knew the frame-exact durations of each, you could specifically pre-define variant comps that loop
x
number of times, then comp swap each into your target depending on how many loops you need. If you have precomps likevid-loops-1
,vid-loops-2
, etc., you could then set a value in the data to swap the comps as if they were footage, too, (by defining them with{{<comp-name>}}
in the data) then there’s no messing with time-remapping-- only Time Sculpting. There could even be another ExtendScript approach that would expand on/automate this idea, where it’s doing those comparison calculations within a function, then swapping between the pre-comps for the variant with the appropriate number of loops.