Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Best way to get the project bit depth from a bunch of .aep files?

Engaged ,
Dec 08, 2024 Dec 08, 2024

I have hundreds of .aep files that I need to obtain the project bit depth of (8, 16, or 32 bit). I can't really find a good way to do this other than open up the file, use a .jsx script to write the bit depth to a file, then close after effects, and repeat for each project file. This is terribly slow, and is very error prone because it won't work properly if for whatever reason a dialog box appears (such as missing media) when attempting to open the project file.

 

Is there any way to parse the binary format of the .aep file to get the project bit depth instead?

 

This is what I'm currently using, if you're interested, but it's really janky and subject to the possible errors I mentioned above. Not to mention it's way slower than simply parsing the .aep file would be:

 

Python script:

 

import subprocess
import os
import time

afterfx_exe = r"C:\Program Files\Adobe\Adobe After Effects 2024\Support Files\AfterFX.exe"
script_path = r'C:\Users\username\Downloads\16bpc_test\write_bit_depth.jsx'

tdir = r'\\netshare\D\rerender\projects'

aeps_to_check = []
for root, dirs, files in os.walk(tdir):
  for file in files:
    fp = os.path.join(root, file)
    if fp.endswith('.aep') and len(file) > 40:
      print(file)
      aeps_to_check.append(fp)

for aep_to_check in aeps_to_check:
  subprocess.Popen(f'"{afterfx_exe}" "{aep_to_check}"')
  print("Sleeping now")
  time.sleep(15)
  s_cmd = f'"{afterfx_exe}" -r {script_path}' # no quotes around the script path!
  subprocess.call(s_cmd)

  with open('bitsPerChannel.txt', 'r') as f:
    data = f.read()
    
  print(data)
  os.remove('bitsPerChannel.txt')
  time.sleep(10)

 

JSX script:

var filePath = "C:/Users/username/Downloads/16bpc_test/bitsPerChannel.txt";
var file = new File(filePath);

if (file.open("w")) 
{
  if (app.project) 
  {
    try 
    {
      var bitsPerChannel = app.project.bitsPerChannel;
      file.writeln(bitsPerChannel);
    } 
    catch (e) 
    {
      file.writeln("Error: Unable to retrieve bitsPerChannel.\n" + e.toString());
    }
  } 
  else 
  {
    file.writeln("Error: No project is currently open.");
  }
  file.close();
} 
else 
{
  alert("Failed to open file for writing:\n" + filePath);
}

app.project.close(CloseOptions.DO_NOT_SAVE_CHANGES);
app.quit();

 

Any advice for a better way to do this?

TOPICS
Error or problem , How to , Scripting
144
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
no replies

Have something to add?

Join the conversation