What's the easiest way to trigger an aerender command from a web page?

Using Templater, I can create renders based on google spreadsheets, but I can't find a good description of how to trigger a render remotely. Is there a good howto guide somewhere? Maybe using PHP or something (not an expert on this)... PS: I'm using a Mac

  • In general php is not made for this purpose, I would you advise against it. Usually then it only remains ruby and python on a web server. I would recommend python, since it's often used and there are many film-related libraries. Also, there is a build-in csv module to parse a spreadsheet. I thought it's a good idea to include site relevant code (how to trigger aerender), because all the other topics seems more fitting for stackoverflow (imo). It's a really interessting question, but it's also quite complex, thus my answer is a rough overview only, so let me know what else you need.
    – p2or
    Sep 11 '15 at 9:39

Depends on which scripting languages your web server supports.

Main requirements

  1. The language should be able to execute the application
  2. The language should provide secure access the files on the server or a network
  3. The language should provide methods to assembly file paths (e.g. relative to absolute paths)
  4. The language should provide interaction methods for connecting the webpage (user input) and your application, also see: https://en.wikipedia.org/wiki/Web_application_framework

Execute aerender via python

Assuming your webserver supports python, execute the app via python's subprocess module. You only have to make sure that you can call aerender from your command line properly.

# import subprocess module to call aerender
import subprocess 

# create a aerender argument list
args = ['aerender', '-project', 'path_to_file']
process = subprocess.Popen(args, stdout=PIPE, stderr=PIPE)

In order to batch process a folder of .aep files you'll need to iterate through the files:

#import os module
import os 

# set the path to your aep folder
path = '/home/user/Desktop/aep-files'    # linux or osx
# path = r'c:\some\directory\aep-files'  # windows, the r is important
# path = 'c:/some/directory\aep-files'   # windows (alternative)

# make sure the files are .aep files
aep_file_folder = [f for f in os.listdir(path) if f.endswith('.aep')] 

# iterate through the list
for i in aep_file_folder:
    # setup correct filepath for aeps
    file_path = os.path.join(path,i)

    # call aerender with the correct arguments
    subprocess.call(['aerender', '-project', file_path])

Note: If there is no need to communicate (e.g. getting the output of aerender) you can simply use subprocess.call instead.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.