Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Forums Adobe After Effects Expressions Replace multiple footage Items with Placeholder Script

  • Replace multiple footage Items with Placeholder Script

  • thiery roussel

    April 8, 2020 at 3:32 pm

    Hi,
    Im working on a project that involve a repetitive task and I will be on that project for 2 more months. There is no way to select multiple footage and perform a replace with placeholder for each. Only one at a time.
    The Problem:
    I select footage items in the project window. Right-click. Replace with / PlaceHolder.
    Then I need to change the resolution and frame rate. I leave the name and duration as is. And I do this 30 times a day. It’s several 3d passes. A kind of batch replace with placeholder script would be helpful. Does a script already exist? My research have been unsuccessful.
    Here is my first attempt at scripting. I’m still getting errors for item.name and item.duration, and after that, nothing happens.??
    Could someone help me debug this.
    Thanks

    /// This script replace multiple footage item with a placeholder. Well... not yet!

    /// project variables
    var project = app.project;
    var item = project.item.selected;

    // placeholder variables and predefined values
    var name = item.name;
    var width = 3840;
    var height = 2160;
    var frameRate = 30;
    var duration = item.duration;

    // function to replace with placeholder
    function(){
    app.beginUndoGroup("replace with place holder");

    for(var i = 1; i <= project.numItems; i++){
    if(project.item(i) instanceof FootageItem){
    project.item(i).replaceWithPlaceholder(name, width, height, frameRate, duration);
    }
    }

    app.endUndoGroup();
    alert("Successfully replace");
    }

  • Scott McGee

    April 9, 2020 at 8:58 am

    This works on any selected items. So you’ll need to update for just footageItems, but hopefully this steers you in the right direction.

    If you can play around with it, I’d update to include undo group like you’ve got in yours, just because you have hit ctrl/cmd + z for every item it’s replaced otherwise, but this will do what you want if you’re just selecting footage layers anyways.

    for (var i = 1; i <= app.project.numItems; i++){
    if (app.project.item(i).selected){
    var name = app.project.item(i).name;
    var width = 1920;
    var height = 1080;
    var framerate = 25;
    var duration = app.project.item(i).duration;

    app.project.item(i).replaceWithPlaceholder(name,width,height,frameRate,duration);
    }
    }

  • thiery roussel

    April 10, 2020 at 5:15 pm

    Hey Scott, Thank you. This is working on his own. I can see where I had it wrong. I had try to swap the MainSource to setProxyWithSequence in the same script, but couldn’t get anything out of the mainSource.file. Any ideas?


    /// Input values
    var width = parseFloat(prompt("Placeholder WIDTH ?"));
    var height = parseFloat(prompt("Placeholder HEIGHT ?"));
    var frameRate = parseFloat(prompt("Placeholder FRAME RATE ?"));

    // Replace function
    app.beginUndoGroup("replace with place holder");

    for (var i = 1; i <= app.project.numItems; i++){
    if (app.project.item(i).selected){

    var name = app.project.item(i).name;
    var duration = app.project.item(i).duration;
    var mainSource = app.project.item(i).mainSource.file;

    app.project.item(i).setProxyWithSequence(mainSource,true);
    app.project.item(i).replaceWithPlaceholder(name,width,height,frameRate,duration);

    }

    app.endUndoGroup();
    }

    alert("Successfully replace");

  • thiery roussel

    April 12, 2020 at 2:52 pm

    Ok, small mistake on my side with the mainSource.file vs .file . I am getting error when the filename is beyond 31 characters? Which is really common with 3D passes. Depending on the footage, I would also like it to work with setProxy and setProxyWithSequence. My quest goes on. Thanks for any help.


    /// Input values
    var width = parseFloat(prompt("Placeholder WIDTH ?"));
    var height = parseFloat(prompt("Placeholder HEIGHT ?"));
    var frameRate = parseFloat(prompt("Placeholder FRAME RATE ?"));

    // Replace with a placeholder and swap to proxy function

    app.beginUndoGroup("replace with a placeholder and swap to proxy");

    for (var i = 1; i <= app.project.numItems; i++){
    if (app.project.item(i).selected){

    var name = app.project.item(i).name;
    var duration = app.project.item(i).duration;
    var file = app.project.item(i).file;

    app.project.item(i).setProxyWithSequence(file,true);
    app.project.item(i).replaceWithPlaceholder(name,width,height,frameRate,duration);

    }

    app.endUndoGroup();
    }

    alert("Successfully replace");

  • Scott McGee

    April 14, 2020 at 7:57 am

    Hey Thiery

    I’m a little confused. Why do you want to turn your video/footage item into a placeholder, then turn it into a proxy sequence?

    Am I missing something?

    A proxy has to be replaced with a file that you want to use as a proxy. Otherwise it’s a placeholder. There for, if you’re wanting to replace with a proxy file. Then you need to point it to a file that it replaces itself with.

    So when I’m working with 4k. I’ll have my lowRes proxies that I’ll mirror and use that folder until I export and replace them all back with the 4k HiRes versions. If that’s the case. Skip out the middle man of the placeholder and tell it to turn all your video files based on location and to match name for name and replace all as proxy if that makes sense.

Viewing 1 - 5 of 5 posts

Log in to reply.

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy