Question about AUTO lengh

Hello Mr. Derk,

I would like to better understand the rule for how the auto length configuration priority works.

In my case, I work with videos and audios generated by AI.

Imagine that, in my template, I want to create an audio element with its duration set to AUTO, and to illustrate this audio, I will use a video element also set to AUTO.

However, I would like the template to automatically trim the video to match the same duration as the audio.

So, after generation, let’s say the audio ends up being 3 seconds long and the video is 5 seconds long.

How can I configure the template so that the video automatically adjusts to have the same duration as the audio?

I thought about setting both to AUTO, but then — how would Shotstack know that the video should be trimmed based on the audio’s duration?

I imagine this might be related to the TRIM or TIMING settings, maybe by using a variable, but I’m having trouble visualizing this workflow… Could you help clarify that, please?

Just a reminder: I will only know the final duration of the audio at render time, so I won’t be able to insert the exact duration during the template creation.

Currently this isn’t possible with the auto feature and would have to be done programmatically, instead of using a template directly.

We do have a roadmap item on the ability to use alias to reference the duration of a different clip. This is currently planned.