Skip to main content
lowdencraftww
Participating Frequently
March 18, 2026
Question

Automation Blocks - Un-nest trimmed sequence in timeline

  • March 18, 2026
  • 1 reply
  • 17 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

    1 reply

    lowdencraftww
    Participating Frequently
    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
    Participating Frequently
    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