Nexrender: Nexrender and AE collect files

Created on 22 Aug 2019  Â·  17Comments  Â·  Source: inlife/nexrender

Hello,

I'm running into an issue where I want to use an aep project together with the (footage) folder you get when you export an AEP project with the 'collect files' option.

I'm using nexrender server & worker. The job arrives properly at the server and the worker picks it up. AErender can't find the footage files associated with the AEP project due to pathing issues. The projects are made under Mac OS and are then sent to the nexrender server which is running windows server 2016.

When I check the logs it is quite obvious why the rendering fails.
_Unable to render: File not found /Users/anon/Projects/render_test/(Footage)/movie.mp4_ which doesn't correspond at all on the windows machine obviously. I'm somewhat surprised adobe bakes absolute (footage) paths into the AEP files instead of relative ones.

While it (I think) doesn't have anything to do with nexrender I was wondering if anyone knew a workaround as I'd reckon more people ran into this issue when using remote rendering.

question

All 17 comments

From my experience, aerender first attempts to look for an absolute path, and if that fails, it falls back on the relative path resolving (attempting to locate files in relation to project file location)

In case you are using nexrender, you can also provide all paths in the assets and use them to deliver assets to your render machines

Hey inlife, while I realize I can provide the assets manually using nexrender but it would be easier for us to (sometimes) use the (footage) folder. It appears though that as if aerender (in render only mode) does not fallback to relative paths for some reason. I'm wondering if this is a known issue or ment to be. It does work when not running in render only mode but that somewhat defeats the purpose of our networked solution.

I'll ask around on the adobe forums to see if I can learn why it does not work in render only mode.

I experienced this issue too, it doesn't seem to look in (footage) or in local directories.

I think this is an AE issue and the way I found around this is to open the AE project file on the nexrender machine where all footage and assets will relink with no issues. Just save the project file again then close AE. It'll now find all footage in the render only mode. Not ideal but it is a quick fix.

Has anyone found another solution to this? I have just the render license on my render node, so I can't open and save the file. I also have to create the AE files on MacOS, and my rendernode is a windows workstation, so paths don't match.

@inlife Also running into the issue described above. Attempted to fix it by relinking with a jsx script, but this has the issue of destroying layer references for PSD files.

Any way to get aerender to look for relative paths, or specify a layer/keep the reference in tact with replace in extendscript?

Is there a possibility of creating a small extendscript snippet that would go over all layers with footage items and do re-import of assets that can be resolved locally for a specified path?

@inlife That's essentially what I did with the following:

function isSourceLayered(av_item) {
    // check if there is a "/"
    if (av_item.name.indexOf("/") != -1) {
        return true;
    }

    return false;
}

function canImportAsComp(file) {
    var io = new ImportOptions(file);

    return io.canImportAs(ImportAsType.COMP);
}

function getPathFromItem(item) {
    if (item.mainSource && item.mainSource.file) {
        return item.mainSource.file.path + "/" + item.mainSource.file.name;
    } else {
        return false;
    }
}

function getReplacePath(path) {
    var matches = path.match(regex);

    if (matches && matches.length) {
        var splitPath = path.split(regex);
        if (splitPath && splitPath.length > 1) {
            var newPath = (NX.projectFolder + matches[matches.length - 1] + splitPath[1]).replace(/\//g, '\\');

            return newPath;
        } else {
            return false;
        }
    } else {
        return false;
    }
}

var regex = /\/\(\w+\)\//;

for (var i = 1; i <= app.project.items.length; i++) {
    var item = app.project.items[i];
    gAECommandLineRenderer.log_file.writeln("ITEM: " + item.name + "[" + item.toString() + "]");

    var path = getPathFromItem(item);
    if (path != false) {
        var replacePath = getReplacePath(path);

        if (replacePath != false) {
            var file = new File(replacePath);

            if (!file.exists) {
                gAECommandLineRenderer.log_file.writeln("ERROR: could not make file from " + replacePath);    
            } else {
                if (!isSourceLayered(item) || (isSourceLayered(item) && !canImportAsComp(file))) {
                    gAECommandLineRenderer.log_file.writeln("INFO: Pointing " + path + " to " + replacePath);
                    item.replace(file); // This works fine
                } else if (isSourceLayered(item) && canImportAsComp(file)) {
                    gAECommandLineRenderer.log_file.writeln("INFO: Pointing layered " + path + " to " + replacePath);
                    item.replace(file); // This shows all contents of the PSD instead of the layer
                }
            }
        } else {
            gAECommandLineRenderer.log_file.writeln("NO REPLACE: " + path);
        }
    }

    gAECommandLineRenderer.log_file.writeln("END ITEM \n");
}

I used a global variable (NX.projectFolder) to point to the path on the worker machine (shared network drive). This loops over all the items, checks if it has a source, if so, tries to replace the file.

The issue is that the project has items in the composition which are specific layers of a PSD file. Calling item.replace(file) on those shows all layers of the PSD instead of just the specific one it was using.

I'm facing the exact same issue now. Is there a fix found yet?

My idea is to open a project file on windows in AE with a script and save it again (just like I do it manually now).
Like this:

var my_file = new File("T:/Project/template-text-blue.aep");
app.open(my_file);
app.save();

But this is just an example of an idea. I do not have a ready and tested script yet

Hey all, had a similar problem since lots of AEPs have the dynamic footage being used by NexRender but then all the static assets used in the AEP (that don’t change).

Below is not an elegant solution, but helps in a pinch:

Save the .aep as an XML based .aep, then open the XML in a text editor and change the absolute path to the windows file path (I did this quickly with find and replace, using my username as a keyword since it’s part of the filepath).

I can confirm that NexRender opens/ renders the aepx file just fine.

Definitely not an elegant solution, and requires there to be a “promise” on the render server of that absolute path existing... but could be a workaround if you don’t have many templates or server instances.

@maxtkacz Thanks for the tip! I did try doing a hex edit of the .aep file to fix the paths but that often corrupted the aep, didn't know you could save it in XML-format. Should actually be all good for my usecase, cheers!

I tried the solution from K-JBoon and it worked for me, thanks!

Hey all, had a similar problem since lots of AEPs have the dynamic footage being used by NexRender but then all the static assets used in the AEP (that don’t change).

Below is not an elegant solution, but helps in a pinch:

Save the .aep as an XML based .aep, then open the XML in a text editor and change the absolute path to the windows file path (I did this quickly with find and replace, using my username as a keyword since it’s part of the filepath).

I can confirm that NexRender opens/ renders the aepx file just fine.

Definitely not an elegant solution, and requires there to be a “promise” on the render server of that absolute path existing... but could be a workaround if you don’t have many templates or server instances.

@maxtkacz But how do you convert an eap file to aepx file? I couldnt find a way to save a project as aepx file programmatically and if i need to open after effect GUI in order to save it as xml, then i can also save the project and relink all paths through AE as well.

@inlife That's essentially what I did with the following:

function isSourceLayered(av_item) {
    // check if there is a "/"
    if (av_item.name.indexOf("/") != -1) {
        return true;
    }

    return false;
}

function canImportAsComp(file) {
    var io = new ImportOptions(file);

    return io.canImportAs(ImportAsType.COMP);
}

function getPathFromItem(item) {
    if (item.mainSource && item.mainSource.file) {
        return item.mainSource.file.path + "/" + item.mainSource.file.name;
    } else {
        return false;
    }
}

function getReplacePath(path) {
    var matches = path.match(regex);

    if (matches && matches.length) {
        var splitPath = path.split(regex);
        if (splitPath && splitPath.length > 1) {
            var newPath = (NX.projectFolder + matches[matches.length - 1] + splitPath[1]).replace(/\//g, '\\');

            return newPath;
        } else {
            return false;
        }
    } else {
        return false;
    }
}

var regex = /\/\(\w+\)\//;

for (var i = 1; i <= app.project.items.length; i++) {
    var item = app.project.items[i];
    gAECommandLineRenderer.log_file.writeln("ITEM: " + item.name + "[" + item.toString() + "]");

    var path = getPathFromItem(item);
    if (path != false) {
        var replacePath = getReplacePath(path);

        if (replacePath != false) {
            var file = new File(replacePath);

            if (!file.exists) {
                gAECommandLineRenderer.log_file.writeln("ERROR: could not make file from " + replacePath);    
            } else {
                if (!isSourceLayered(item) || (isSourceLayered(item) && !canImportAsComp(file))) {
                    gAECommandLineRenderer.log_file.writeln("INFO: Pointing " + path + " to " + replacePath);
                    item.replace(file); // This works fine
                } else if (isSourceLayered(item) && canImportAsComp(file)) {
                    gAECommandLineRenderer.log_file.writeln("INFO: Pointing layered " + path + " to " + replacePath);
                    item.replace(file); // This shows all contents of the PSD instead of the layer
                }
            }
        } else {
            gAECommandLineRenderer.log_file.writeln("NO REPLACE: " + path);
        }
    }

    gAECommandLineRenderer.log_file.writeln("END ITEM \n");
}

I used a global variable (NX.projectFolder) to point to the path on the worker machine (shared network drive). This loops over all the items, checks if it has a source, if so, tries to replace the file.

The issue is that the project has items in the composition which are specific layers of a PSD file. Calling item.replace(file) on those shows all layers of the PSD instead of just the specific one it was using.

@K-JBoon @SMakc i am kinda new to nexrender and can you tell how you used that script? Did you add it into nexrender.jsx or pass it to the json as script file? I couldnt make it work, can you help me to use it?

Thank you

Pass it to the JSON as a script asset yeah

@K-JBoon Thank you it worked!

The issue is that the project has items in the composition which are specific layers of a PSD file. Calling item.replace(file) on those shows all layers of the PSD instead of just the specific one it was using.

I faced the same problem using this solution. @K-JBoon have you found a way around this?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

oskobri picture oskobri  Â·  3Comments

senthudms picture senthudms  Â·  3Comments

Morreski picture Morreski  Â·  5Comments

Dezzymei picture Dezzymei  Â·  3Comments

byumark picture byumark  Â·  3Comments