Skip to main content
lowdencraftww
Known Participant
March 18, 2026
Question

Automation Blocks - Un-nest trimmed sequence in timeline

  • March 18, 2026
  • 2 replies
  • 37 views

Hello

I am investigating if it is possible to automate the batch unnesting of trimmed nested clipped in timeline, creating new video channels for the “exposed” clips? (Just like Resolve’s decompose clip)

I can see a sequence nesting script in the community scripts that I am trying to retro fit for this need.

Could it be possible? 

Any thoughts most welcome

Thank you

    2 replies

    Mathias Moehl
    Community Expert
    Community Expert
    July 1, 2026

    Sorry for the delayed reply. Since the forum migration, I apparently stopped receiving notifications for some Automation Blocks questions, so I’m only catching up on them now.

    This is an interesting idea. For simple nested sequences, it may be possible with Automation Blocks and some custom code, but I would not describe it as a ready-made “Decompose Clip” replacement like in Resolve.

    The basic logic would be:

    1. Find the selected nested clip in the active sequence.

    2. Detect which sequence this nested clip refers to.

    3. Read the trim range of the nested clip.

    4. Look inside the nested sequence and find the clips that overlap that trim range.

    5. Recreate those clips in the parent sequence at the correct time positions, possibly on newly created video tracks.

    6. Optionally remove or disable the original nested clip.

    So for a simple nest that contains normal clips, no complex timing changes, and a predictable track layout, this could probably be scripted.

    The tricky part is making it reliable for all real-world cases. Things like transitions, effects, speed changes, time remapping, adjustment layers, linked audio, nested nests, track targeting, and overlaps can make this much more complex. Also, the existing community script for nesting goes in the opposite direction; un-nesting is not just the reverse operation, because the script has to translate the visible trimmed range of the nested clip back into the timeline of the nested sequence.

    So my answer would be: yes, this is a possible custom Automation Blocks scripting project for a controlled/simple use case, but probably not something I would recommend as a general-purpose one-click “decompose everything” tool without more testing.

    If you can share a very small example project or describe the exact structure of the nested sequences, I can better judge how realistic it is for that specific case.

    Mathias Möhl - Developer of tools like BeatEdit and Automation Blocks for Premiere Pro and After Effects
    lowdencraftww
    Known Participant
    March 24, 2026

    The code below un-nests multicam trimmed sequences into elements stacked above the embedded source. But it does not respect the multicam source in point and seems to loop for each multicam source, therefore erasing what it has created. It also does not the end point either. But it does UN-NEST sequences in video tracks above the sources in the timeline.

    function ti(v){return Math.floor(v*1);}

    function findNS(nm,aid){
    for(var si=0;si<app.project.sequences.numSequences;si++){
    var c=app.project.sequences[si];
    if(c.sequenceID===aid)continue;
    if(c.name===nm)return c;}
    return null;}

    var cIds=[],cSeqs=[];
    function getCS(nid,nm,aid){
    for(var ki=0;ki<cIds.length;ki++){
    if(cIds[ki]===nid)return cSeqs[ki];}
    var r=findNS(nm,aid);
    cIds.push(nid);cSeqs.push(r);return r;}

    var ok=true;
    var seq=app.project.activeSequence;
    if(!seq){alert("No active sequence.");ok=false;}

    var sel=ok?seq.getSelection():null;
    if(ok&&(!sel||sel.length===0)){alert("No clips selected.");ok=false;}

    if(ok){
    var aid=seq.sequenceID;
    var uCount=0,sCount=0;

    for(var ci=0;ci<sel.length;ci++){
    var nc=sel[ci];
    if(!nc||!nc.projectItem){sCount++;continue;}
    if(nc.mediaType!=="Video"){continue;}

    var ns=getCS(nc.projectItem.nodeId,nc.projectItem.name,aid);
    if(!ns){sCount++;continue;}

    var nSt=ti(nc.start.ticks);
    var nEn=ti(nc.end.ticks);
    var nIn=ti(nc.inPoint.ticks);
    var nDur=nEn-nSt;
    var nOut=nIn+nDur;
    var baseV=nc.parentTrackIndex+1;
    var baseA=nc.parentTrackIndex+1;
    var placed=false;

    var vI=ns.videoTracks;
    var vP=seq.videoTracks;
    for(var vt=0;vt<vI.numTracks;vt++){
    var vIT=vI[vt];
    var tVI=baseV+vt;
    if(tVI>=vP.numTracks)continue;
    var vPT=vP[tVI];
    if(!vPT)continue;
    for(var vc=0;vc<vIT.clips.numItems;vc++){
    var vic=vIT.clips[vc];
    if(!vic||!vic.projectItem)continue;
    var s0=ti(vic.start.ticks);
    var e0=ti(vic.end.ticks);
    var i0=ti(vic.inPoint.ticks);
    var o0=ti(vic.outPoint.ticks);
    if(e0<=nIn||s0>=nOut)continue;
    var vSrcIn=i0+(nIn-s0);
    var vSrcOut=vSrcIn+nDur;
    if(vSrcOut>o0)vSrcOut=o0;
    if(vSrcIn<i0)vSrcIn=i0;
    try{
    var vp=new Time();vp.ticks=String(nSt);
    var vti=new Time();vti.ticks=String(vSrcIn);
    var vto=new Time();vto.ticks=String(vSrcOut);
    vPT.overwriteClip(vic.projectItem,vp,vti,vto);
    placed=true;}
    catch(ve){}}}

    var aI=ns.audioTracks;
    var aP=seq.audioTracks;
    for(var at=0;at<aI.numTracks;at++){
    var aIT=aI[at];
    var tAI=baseA+at;
    if(tAI>=aP.numTracks)continue;
    var aPT=aP[tAI];
    if(!aPT)continue;
    for(var ac=0;ac<aIT.clips.numItems;ac++){
    var aic=aIT.clips[ac];
    if(!aic||!aic.projectItem)continue;
    var s1=ti(aic.start.ticks);
    var e1=ti(aic.end.ticks);
    var i1=ti(aic.inPoint.ticks);
    var o1=ti(aic.outPoint.ticks);
    if(e1<=nIn||s1>=nOut)continue;
    var aSrcIn=i1+(nIn-s1);
    var aSrcOut=aSrcIn+nDur;
    if(aSrcOut>o1)aSrcOut=o1;
    if(aSrcIn<i1)aSrcIn=i1;
    try{
    var ap=new Time();ap.ticks=String(nSt);
    var ati=new Time();ati.ticks=String(aSrcIn);
    var ato=new Time();ato.ticks=String(aSrcOut);
    aPT.overwriteClip(aic.projectItem,ap,ati,ato);
    placed=true;}
    catch(ae){}}}

    if(placed){uCount++;}else{sCount++;}}

    alert("Done!\nStacked: "+uCount+"\nSkipped: "+sCount);}

     

     

    lowdencraftww
    Known Participant
    March 24, 2026

    On the other hand, the method below works … and could be looped. 

    How to Un Nest a nested clip in premiere while preserving the cut - YouTube