Parsers¶
Main Entry Point¶
parse
¶
parse(
aep_file_path: str | PathLike[str],
*,
ae_preferences_dir: str | PathLike[str] | None = None,
) -> Application
Parse an After Effects (.aep) project file and return an Application instance.
This is the main entry point for the library. It parses the binary RIFX data and returns an Application object whose project attribute holds the full project tree.
Parameters:
-
aep_file_path(str | PathLike[str]) –Path to the
.aepfile. -
ae_preferences_dir(str | PathLike[str] | None, default:None) –Optional path to the AE preferences directory (e.g.
C:/Users/<user>/AppData/Roaming/Adobe/After Effects/25.6). When provided, render settings and output module templates are parsed lazily when needed.
new
¶
new(
version: str = _DEFAULT_NEW_VERSION,
*,
ae_preferences_dir: str | PathLike[str] | None = None,
) -> Application
Creates a new project in After Effects, replicating the File > New > New Project menu command.
Returns an Application wrapping an empty Project (containing only the root folder and an empty render queue).
Parameters:
-
version(str, default:_DEFAULT_NEW_VERSION) –The After Effects version to stamp into the file, formatted as
"{major}.{minor}x{build}"(e.g."26.0x67"). A file stamped at version N opens in After Effects N and later. -
ae_preferences_dir(str | PathLike[str] | None, default:None) –Optional path to the AE preferences directory (e.g.
C:/Users/<user>/AppData/Roaming/Adobe/After Effects/26.0), required only for adding items to the render queue.
Utilities¶
list_layers
¶
Return the selectable layer names of a layered file, top layer first.
The order and contents match After Effects' "Choose Layer" import dropdown: leaf layers only, top-most first. Duplicate names are possible (Photoshop does not enforce unique layer names).
Parameters:
Raises:
-
ValueError–If the extension is not a layered format, or the file's layers cannot be enumerated (
UnsupportedPsdLayersError/UnsupportedAiLayersError, bothValueErrorsubclasses).
read_ai_layer_bounds
¶
Return each Illustrator/PDF layer's artwork bounds in document order.
The bounds are the box After Effects stores for a "Layer Size" import,
in page points with the origin at the page's bottom-left corner, as
(x0, y0, x1, y1). They are a conservative estimate of the artwork
extent, not its true visual bounds - see the module docstring.
Parameters:
-
file(str | PathLike[str]) –Path to a
.aior.pdffile. -
data(bytes | None, default:None) –The file's bytes, if the caller already read them.
Returns:
-
list[Box | None]–One entry per layer in
resolvers.ai_layers.read_ai_layersorder -
list[Box | None]–(bottom layer first),
Nonefor a layer with no artwork on the page.
Warns:
-
UserWarning–If the document has more than one artboard, where After Effects measures the second page and py_aep measures the first.
Raises:
-
UnsupportedAiLayersError–If the file is not a PDF-compatible document, has no layers, or uses PDF structures py_aep cannot read (compressed object streams, encryption, or a content-stream filter other than Flate).
footage_size
¶
The footage pixel size After Effects derives from an artwork box.
The box reaches AE through the opti's signed 16.16 field, and AE sizes
the footage from what it reads back, so the extent is quantized before it
is ceilinged - an extent that lands a float hair above an integer must not
gain a pixel. A layer with no artwork floors at 1x1.
Parameters:
-
box(Box | None) –An entry of
read_ai_layer_bounds, orNonefor an empty layer.
probe_media
¶
Read footage metadata from a media file's header.
Parameters:
-
file(Path) –Path to the source media file (drives the format dispatch).
-
data(bytes | None, default:None) –The file's bytes, if the caller already read them; probed in memory instead of re-reading
file.
Raises:
-
NotImplementedError–If header probing is not implemented for the file's extension.