ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Replace multiple footage Items with Placeholder Script

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
thiery roussel
Replace multiple footage Items with Placeholder Script
on Apr 8, 2020 at 3:32:49 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 &lt;= project.numItems; i++){
if(project.item(i) instanceof FootageItem){
project.item(i).replaceWithPlaceholder(name, width, height, frameRate, duration);
}
}

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




Return to posts index

Scott McGee
Re: Replace multiple footage Items with Placeholder Script
on Apr 9, 2020 at 8:58:18 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);
}
}


Return to posts index

thiery roussel
Re: Replace multiple footage Items with Placeholder Script
on Apr 10, 2020 at 5:15:30 pm
Last Edited By thiery roussel on Apr 11, 2020 at 1:42:00 am

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");




Return to posts index


thiery roussel
Re: Replace multiple footage Items with Placeholder Script
on Apr 12, 2020 at 2:52:56 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");




Return to posts index

Scott McGee
Re: Replace multiple footage Items with Placeholder Script
on Apr 14, 2020 at 7:57:12 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.


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2020 CreativeCOW.net All Rights Reserved
[TOP]