Skip to main content
Known Participant
December 21, 2024
Question

Link/ Unlink multiple clips at the same time?

  • December 21, 2024
  • 3 replies
  • 2909 views

Hello,

So on my timeline, I synced with Syncaila all my Video+Audio tracks with my external voice over mics. The voice over track sit just under.

Is there any way to batch link & unlink multiple clips? The option is grayed out.

My solution is to Nest and Detect & Cut scene, but is there anything else I can do?

3 replies

ThioJoe
Community Expert
Community Expert
December 21, 2024

Here's a script I came up with that should do it. It will link audio clips that have the same exact start/end points as each video clip. The video clips should all be on the same track, you can set which one to use by changing the number of the `

trackNumberWithVideo` variable. Then you can set which audio track numbers on which to look for matching audio clips to link with `audioTrackNumbersToLink`. 
 
To run the script save the code below in a file ending with ".jsx", then you'll need a plugin since Premiere doesn't seem to have a built in way for some reason.  You can just use this plugin from the Adobe Exchange which is simple but seems to work: https://exchange.adobe.com/apps/cc/12096/jsx-launcher
 
So basically:
1. Open notepad and paste in the below code (it's fine to include everything even the comment lines starting with //)
2. Edit the two options if you need.
3. Save the file as any name with the extension ".jsx"
4. Acquire the plugin mentioned above or some other plugin that lets you run scripts. 
5. Assuming you used the JSX Launcher one, go to Window > Extensions > JSX Launcher.
6. When the extension panel comes up click the little hamburger menu next to where it says "JSX Launcher" and hit "Select Script Folder" to set the folder that contains the jsx file you saved. 
7. Make sure the sequence that has the clips you want to link open and then click the script in the extension panel to run it. It might not look like it's doing anything but it will pop up a box when it's done.
 
To unlink clips on the other hand, you can just bulk select them and hit 'Unlink'.
 
/// ---------------- Options ----------------
// You can set this to the track number that contains the video clips you want to link with audio clips
var trackNumberWithVideo = 1;
// The list of audio track numbers it will look for matching audio clips. It will link any audio clips that have the same starting/ending points as each video clip
// Should be a comma-separated list of numbers between brackets, e.g. [1, 2, 3]  - For a single track still use brackets like: [1]
var audioTrackNumbersToLink = [1, 2, 3, 4];

// ----------------------------------------------------------------
var activeSeq = app.project.activeSequence;
// First get all the selected items so we can deselect them
var selectedItems = activeSeq.getSelection();
for (var i = 0; i < selectedItems.length; i++) {
    selectedItems[i].setSelected(false, true);
}

// Get all the video clips on the track index (trackNumberWithVideo - 1)
var videoClips = [];
for (var i = 0; i < activeSeq.videoTracks[trackNumberWithVideo - 1].clips.numItems; i++) {
    var clip = activeSeq.videoTracks[trackNumberWithVideo - 1].clips[i];
    videoClips.push(clip);
    }

// Create dictionarys to store the clips. The video dictionary will have an index for the key and video clip object as value
// The audio dictionary will have an index for the key and an array of audio clips as value
var videoIndexDict = {};
var audioIndexDict = {};

// Now on each audio track, find any clips that match up with the same starting/ending points as the video clips
for (var i = 0; i < audioTrackNumbersToLink.length; i++) { // Loops per audio track

    var audioClips = [];
    var audioTrackNumber = audioTrackNumbersToLink[i];
    var audioTrackIndex = audioTrackNumber - 1; // Track indexes are 0-based, so we subtract 1 from the audio track number

    // Ensure the audio track exists
    if (audioTrackNumber > activeSeq.audioTracks.numTracks) {
        alert("Audio track " + audioTrackNumbersToLink[i] + " does not exist in the sequence. Be sure to set the audioTrackNumbersToLink variable to existing track numbers.");
        continue;
    }

    // Get the audio clips on the track
    for (var j = 0; j < activeSeq.audioTracks[audioTrackIndex].clips.numItems; j++) {
        var clip = activeSeq.audioTracks[audioTrackIndex].clips[j];
        audioClips.push(clip);
    }

    // Now compare the audio clips to the video clips
    for (var j = 0; j < audioClips.length; j++) {
        for (var k = 0; k < videoClips.length; k++) {
            if (audioClips[j].start.ticks == videoClips[k].start.ticks && audioClips[j].end.ticks == videoClips[k].end.ticks) {
                // Store the clips in the dictionary
                // If there's not already a value, create a new array with the audio clip, otherwise add it to the existing array
                var videoClip = videoClips[k];
                var audioClip = audioClips[j];

                // Store clips in Dictionary
                videoIndexDict[k] = videoClip;
                if (typeof audioIndexDict[k] === 'undefined') {
                    audioIndexDict[k] = [audioClip];
                } else {
                    audioIndexDict[k].push(audioClip);
                }
                
            }
        }
    }
}

// Now link the clips
for (var key in videoIndexDict) {
    var x = Number(key);
    var videoClip = videoIndexDict[x];
    var audioClipsArray = []; // Ensure it's empty
    var audioClipsArray = audioIndexDict[x];

    // Select the audio clips then video clip so we can link them
    // First parameter is whether to deselect other clips, second parameter is whether to refresh the GUI
    for (var i = 0; i < audioClipsArray.length; i++) {
        audioClipsArray[i].setSelected(true, false); 
    }
    videoClip.setSelected(true, true);

    // Link the selected clips
    activeSeq.linkSelection();

    // Deselect the audio/video clips again so we can select the next set
    for (var i = 0; i < audioClipsArray.length; i++) {
        audioClipsArray[i].setSelected(false, false); 
    }
    videoClip.setSelected(false, true);
}

alert("Done linking clips");
Inspiring
February 25, 2025

What a great script! Thanks so much for sharing with us. How Adobe haven't enabled a simple linking function for multiple clips at once, I just can't understand! OP's situation must be a very common thing - I know it's something I have to deal with on just about every job!

Professional film maker/editor since 2004, working on MBP M4 Max 128GB, 4TB SSD
R Neil Haugen
Legend
December 21, 2024

Linking one or more video and audio clips in Premiere, as Paul wisely suggests, is to be done using the Multicam process.

Everyone's mileage always varies ...
Known Participant
December 21, 2024

I don't really get how to do such things. I will have to search more on the multicam process.

Everything's on my timeline, all synced perfectly together; from there, I have to merge into multicam sequence?

Community Expert
December 21, 2024

No, linking in Premiere Pro only works for a single audio and video clip stacked vertically in the Timeline.

If you're looking to link multiple clips with matching audio, I recommend exploring the Multicamera Source Sequence feature. You can create this by going to Clip > Create Multicamera Source Sequence. This process will add each clip with its matching audio into its own multicamera sequence, which might suit your workflow better.


For more detailed instructions, check out Adobe's guide here: Create Multicamera Source Sequence.

Known Participant
December 21, 2024

I guess I will have to learn more on how Multicamera Sequence works because, for now, my brain just doesn't see how I can fix my problem with multicamera Sequence.

R Neil Haugen
Legend
December 21, 2024

You are trying to link video with separate audio, correct? With maybe different cameras?

 

If so that's precisely what multicam is for.

Everyone's mileage always varies ...