Hi Chris,
as Nathan said, subprocess is definitly the way to go. I wrote this
function last year for a standalone render script. I decided to use
subprocess.call instead of popen (call is a just a convenience function
for popen). Perhaps it doesn't exactly fit your needs and perhaps it is
not as nifty as it could be but it should give you some more ideas for
tinkering ;)
It looks after a given comp if you dont give a comp-name it trys to
render the render qeueu as it is saved in your ae file and it creates
output directorys especially if youe render a file sequence (set "seq=0"
if you render to a single videofile like .mov) RM and OM are the
rendermodule and outputmodule as you named them in in AE.
dont forget to import subprocess and os...
def AErender_this(project=None, comp=None, output=None, start=None,
stop=None, RM='Optimale Einstellungen', OM='seq_jpg', seq=1, mp=1):
# AErender_this v1.2.bmw_m 29.06.2011
AEexec = 'C:\\Program Files\\Adobe\\Adobe After Effects
CS5.5\\Support Files\\aerender.exe'
sequence='_[#####]'
if not project and not comp:
print('! no project-file defined - displaying version only')
param = [AEexec, '-version']
elif project and not comp:
print('! rendering project queue')
param = [AEexec, '-project', project]
elif project and comp:
print('! rendering composition: ' + comp)
if not seq:
output = output + '/' + comp
else:
print('! sequence mode - looking for output dir')
output = os.path.normpath( output + '/' + comp )
if not os.path.isdir(output):
print('! not found - creating directory: '+output)
os.mkdir(output)
else:
print('! success: '+output)
output = output + '/' + comp + sequence
param = [AEexec, '-project', project, '-comp', comp, '-s',
str(start), '-e', str(stop), '-output', output, '-RStemplate', RM,
'-OMtemplate', OM]
if mp:
param.append('-mp')
p = subprocess.call(param, shell=True)
#print(p)
return(p)
The behaviour of the aerender.exe is a bit strange, "shell=True" is a
must, even if the python documentation recommends you to set it to
false. In an OS X environment you have to pack all your arguments
including spaces into one single argument for subprocess, if you try to
do it with a list, aerender won't recognize your arguments, it just
returns strange exitcodes that are not documented (of course they are
not - it's adobe ;) )
hope that helps - have a nice weekend instead of tinkering too much,
fabian
Am 27.07.2012 19:57, schrieb tw1sted1981:
I have a write node that I am feeding into AfterEffects and then
reading the contents back into Nuke. I have the command line for AE
all figured out and I have been looking online here at some examples
using ffmpeg but I just cant seem to get my code to work in the script
editor I am using a PC and this is the command line I would want to
execute
C:\Program Files\Adobe\Adobe After Effects CS5.5\Support
Files\aerender -project C:\afterFX\AE_file.aep -comp "rendercomp" -s 1
-e 50
This is the post I was trying to adjust to make work for my intents
but no luck
http://forums.thefoundry.co.uk/phpBB2/viewtopic.php?t=6777&highlight=execute+command
Can anyone make any suggestions, I think I am mostly having trouble
knowing what should be in quotes and what shouldnt be.
I was also wondering if whenrunning these kinds of scripts in the
script editor if you see the program load up, even with the ffmpeg
code I just get a '# Result:'
I will tinker more during the weekend but I am sure someone can point
me in the right direction Smile
As always thanks in advance
-Chris
_______________________________________________
Nuke-python mailing list
[email protected], http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python
_______________________________________________
Nuke-python mailing list
[email protected], http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python