Skip to content

API Reference

Welcome to the AEP Parser API reference. This section provides detailed documentation for all modules, classes, and functions in the library.

Main Entry Point

The primary function you'll use is:

parse_project

parse_project(aep_file_path: str | PathLike[str]) -> Project

Parse an After Effects (.aep) project file.

Parameters:

Name Type Description Default
aep_file_path str | PathLike[str]

path to the project file

required
Source code in src/aep_parser/parsers/project.py
def parse_project(aep_file_path: str | os.PathLike[str]) -> Project:
    """
    Parse an After Effects (.aep) project file.

    Args:
        aep_file_path: path to the project file
    """
    file_path = os.fspath(aep_file_path)
    with Aep.from_file(file_path) as aep:
        root_chunks = aep.data.chunks

        root_folder_chunk = find_by_list_type(chunks=root_chunks, list_type="Fold")
        nnhd_chunk = find_by_type(chunks=root_chunks, chunk_type="nnhd")
        nnhd_data = nnhd_chunk.data

        project = Project(
            bits_per_channel=map_bits_per_channel(
                get_enum_value(nnhd_data.bits_per_channel)
            ),
            effect_names=_get_effect_names(root_chunks),
            expression_engine=_get_expression_engine(root_chunks),  # CC 2019+
            file=file_path,
            footage_timecode_display_start_type=map_footage_timecode_display_start_type(
                get_enum_value(nnhd_data.footage_timecode_display_start_type)
            ),
            frame_rate=nnhd_data.frame_rate,
            frames_count_type=map_frames_count_type(
                get_enum_value(nnhd_data.frames_count_type)
            ),
            project_items={},
            time_display_type=map_time_display_type(
                get_enum_value(nnhd_data.time_display_type)
            ),
        )

        project.xmp_packet = ET.fromstring(aep.xmp_packet)
        software_agents = project.xmp_packet.findall(
            path=SOFTWARE_AGENT_XPATH, namespaces=XMP_NAMESPACES
        )
        if software_agents:
            project.ae_version = software_agents[-1].text

        root_folder = parse_folder(
            is_root=True,
            child_chunks=root_folder_chunk.data.chunks,
            project=project,
            item_id=0,
            item_name="root",
            label=Aep.Label(0),
            parent_folder=None,
            comment="",
        )
        project.project_items[0] = root_folder

        # Link layers to their source items and parent layers
        for composition in project.compositions:
            # Build layer lookup by id for this composition
            layers_by_id = {layer.layer_id: layer for layer in composition.layers}
            for layer in composition.layers:
                if layer.layer_type == Aep.LayerType.footage:
                    layer.source = project.project_items.get(layer.source_id)
                if layer.parent_id is not None:
                    layer.parent = layers_by_id.get(layer.parent_id)

        return project

Core Modules

Project

The main Project dataclass containing all project information.

Items

Project items represent different types of content in the project panel:

Layers

Layers are the building blocks of compositions:

Properties

Properties control layer appearance and behavior:

Sources

Sources provide the content for footage items:

Enums

Enumerations for various After Effects settings and modes.

Parsers

Internal parsing functions for converting binary data to Python objects.

Quick Example

from aep_parser import parse_project

# Parse a project
project = parse_project("myproject.aep")

# Access compositions
for item in project:
    if hasattr(item, 'layers'):  # It's a CompItem
        print(f"Composition: {item.name}")
        for layer in item:
            print(f"  Layer: {layer.name}")