fix AE render
This commit is contained in:
parent
e57134af26
commit
9dd516d624
1 changed files with 47 additions and 6 deletions
|
@ -173,13 +173,30 @@ def run_output(command, **kwargs):
|
||||||
stderr=subprocess.STDOUT)
|
stderr=subprocess.STDOUT)
|
||||||
|
|
||||||
|
|
||||||
|
def run_once(command, **kwargs):
|
||||||
|
DETACHED_PROCESS = 0x00000008
|
||||||
|
return subprocess.Popen(
|
||||||
|
fmt_command(command, **kwargs),
|
||||||
|
shell=False,
|
||||||
|
stdin=None,
|
||||||
|
stdout=None,
|
||||||
|
stderr=None,
|
||||||
|
close_fds=True,
|
||||||
|
creationflags=DETACHED_PROCESS)
|
||||||
|
|
||||||
|
|
||||||
def enqueue_job(event):
|
def enqueue_job(event):
|
||||||
event_id = str(event['id'])
|
event_id = str(event['id'])
|
||||||
if (os.path.exists(os.path.join(args.project, event_id + '.ts')) or os.path.exists(os.path.join(args.project, event_id + '.mov'))) and not args.force:
|
if (os.path.exists(os.path.join(args.project, event_id + '.ts')) or os.path.exists(os.path.join(args.project, event_id + '.mov'))) and not args.force:
|
||||||
event_print(event, "file exist, skipping " + str(event['id']))
|
event_print(event, "file exist, skipping " + str(event['id']))
|
||||||
return
|
return
|
||||||
work_doc = os.path.join(tempdir.name, event_id + '.aepx')
|
work_doc = os.path.join(tempdir.name, event_id + '.aepx')
|
||||||
intermediate_clip = os.path.join(tempdir.name, event_id + '.mov')
|
script_doc = os.path.join(tempdir.name, event_id+'.jsx')
|
||||||
|
ascript_doc = os.path.join(tempdir.name, event_id+'.scpt')
|
||||||
|
if platform.system() == 'Windows':
|
||||||
|
intermediate_clip = os.path.join(tempdir.name, event_id + '.avi')
|
||||||
|
else:
|
||||||
|
intermediate_clip = os.path.join(tempdir.name, event_id + '.mov')
|
||||||
|
|
||||||
if event_id == 'pause' or event_id == 'outro' or event_id == 'bgloop':
|
if event_id == 'pause' or event_id == 'outro' or event_id == 'bgloop':
|
||||||
copyfile(args.project + event_id + '.aepx', work_doc)
|
copyfile(args.project + event_id + '.aepx', work_doc)
|
||||||
|
@ -196,34 +213,58 @@ def enqueue_job(event):
|
||||||
locationpath=intermediate_clip)
|
locationpath=intermediate_clip)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
with open(args.project + 'intro.aepx', 'r') as fp:
|
with open(args.project + 'intro.jsx', 'r') as fp:
|
||||||
scriptstr = fp.read()
|
scriptstr = fp.read()
|
||||||
|
|
||||||
|
scriptstr = scriptstr.replace("$filename", work_doc.replace("\\", "/"))
|
||||||
for key, value in event.items():
|
for key, value in event.items():
|
||||||
value = str(value).replace('"', '\\"')
|
value = str(value).replace('"', '\\"')
|
||||||
scriptstr = scriptstr.replace("$" + str(key), value)
|
scriptstr = scriptstr.replace("$" + str(key), value)
|
||||||
|
|
||||||
with open(work_doc, 'w', encoding='utf-8') as fp:
|
with open(script_doc, 'w', encoding='utf-8') as fp:
|
||||||
fp.write(scriptstr)
|
fp.write(scriptstr)
|
||||||
|
|
||||||
|
copyfile(args.project+'intro.aepx',work_doc)
|
||||||
|
|
||||||
if platform.system() == 'Darwin':
|
if platform.system() == 'Darwin':
|
||||||
run(r'/Applications/Adobe\ After\ Effects\ 2020/aerender -project {jobpath} -comp "intro" -mp -output {locationpath}',
|
copyfile(args.project+'intro.scpt',ascript_doc)
|
||||||
|
run('osascript {ascript_path} {jobpath} {scriptpath}',
|
||||||
|
jobpath=work_doc,
|
||||||
|
scriptpath=script_doc,
|
||||||
|
ascript_path=ascript_doc)
|
||||||
|
|
||||||
|
run(r'/Applications/Adobe\ After\ Effects\ 2022/aerender -project {jobpath} -comp "intro" -mp -output {locationpath}',
|
||||||
jobpath=work_doc,
|
jobpath=work_doc,
|
||||||
locationpath=intermediate_clip)
|
locationpath=intermediate_clip)
|
||||||
|
|
||||||
if platform.system() == 'Windows':
|
if platform.system() == 'Windows':
|
||||||
run(r'C:/Program\ Files/Adobe/Adobe\ After\ Effects\ 2020/Support\ Files/aerender.exe -project {jobpath} -comp "intro" -mp -output {locationpath}',
|
run_once(r'C:/Program\ Files/Adobe/Adobe\ After\ Effects\ 2022/Support\ Files/AfterFX.exe -noui -r {scriptpath}',
|
||||||
|
scriptpath=script_doc)
|
||||||
|
|
||||||
|
time.sleep(2)
|
||||||
|
|
||||||
|
run(r'C:/Program\ Files/Adobe/Adobe\ After\ Effects\ 2022/Support\ Files/aerender.exe -project {jobpath} -comp "intro" -mfr on 100 -output {locationpath}',
|
||||||
jobpath=work_doc,
|
jobpath=work_doc,
|
||||||
locationpath=intermediate_clip)
|
locationpath=intermediate_clip)
|
||||||
if args.debug or args.keep:
|
if args.debug or args.keep:
|
||||||
|
path = tempdir.name
|
||||||
|
dirs = os.listdir( path )
|
||||||
|
|
||||||
|
for file in dirs:
|
||||||
|
print(file)
|
||||||
copyfile(work_doc, args.project + event_id + '.aepx')
|
copyfile(work_doc, args.project + event_id + '.aepx')
|
||||||
|
copyfile(script_doc, args.project + event_id + '.jsx')
|
||||||
|
copyfile(intermediate_clip, args.project + event_id + '.avi')
|
||||||
|
|
||||||
return event_id
|
return event_id
|
||||||
|
|
||||||
|
|
||||||
def finalize_job(job_id, event):
|
def finalize_job(job_id, event):
|
||||||
event_id = str(event['id'])
|
event_id = str(event['id'])
|
||||||
intermediate_clip = os.path.join(tempdir.name, event_id + '.mov')
|
if platform.system() == 'Windows':
|
||||||
|
intermediate_clip = os.path.join(tempdir.name, event_id + '.avi')
|
||||||
|
else:
|
||||||
|
intermediate_clip = os.path.join(tempdir.name, event_id + '.mov')
|
||||||
final_clip = os.path.join(os.path.dirname(args.project), event_id + '.ts')
|
final_clip = os.path.join(os.path.dirname(args.project), event_id + '.ts')
|
||||||
|
|
||||||
if args.alpha:
|
if args.alpha:
|
||||||
|
|
Loading…
Add table
Reference in a new issue