Skip to content

Av item

AVItem

Bases: Item

The AVItem object provides access to attributes and methods of audio/visual files imported into After Effects.

Info

AVItem is a subclass of Item. All methods and attributes of Item are available when working with AVItem.

Info

AVItem is the base class for both CompItem and FootageItem, so AVItem attributes and methods are also available when working with CompItem and FootageItem objects. See CompItem object and FootageItem object.

See: https://ae-scripting.docsforadobe.dev/item/avitem/

Attributes

comment

comment: str

The item comment. Read / Write.

duration

duration: float

The duration of the item in seconds. Still footages have a duration of 0. Read-only.

frame_duration

frame_duration: int

The duration of the item in frames. Still footages have a duration of 0. Read-only.

frame_rate

frame_rate: float

The frame rate of the item in frames-per-second. Read-only.

frame_time

frame_time: int

The current time of the item when it is being previewed directly from the Project panel. This value is a number of frames.

guides

guides: list[Guide]

The item's ruler guides. Each guide has an orientation and a pixel position. Read-only.

has_audio

has_audio: bool

When True, the AVItem has an audio component.

In a CompItem, the value is linked to the composition. In a FootageItem, the value is linked to the main_source or proxy_source object.

has_video

has_video: bool

True if the item has a video component.

An AVItem has video when it has non-zero dimensions (width > 0 and height > 0). In a CompItem, the value is always True. In a FootageItem, the value depends on the footage source (e.g. audio-only files return False).

height

height: int

The height of the item in pixels. Read-only.

id

id = ChunkField[int](
    "_idta", "item_id", read_only=True, default=0
)

The item unique identifier. Read-only.

label

label = enum(Label, '_idta', 'label', default=NONE)

The label color. Colors are represented by their number (0 for None, or 1 to 16 for one of the preset colors in the Labels preferences). Read / Write.

name

name = ChunkField[str](
    "_name_utf8", "value", validate=validate_name
)

The name of the item, as shown in the Project panel. Read / Write.

parent_folder

parent_folder: FolderItem | None

The parent folder of this item. None for the root folder. Read-only.

pixel_aspect

pixel_aspect: float

The pixel aspect ratio of the item (1.0 is square). Read-only.

proxy_source

proxy_source: (
    FileSource | SolidSource | PlaceholderSource | None
)

The FootageSource being used as a proxy. Read-only.

To change it, call any of the AVItem methods that change the proxy source: set_proxy(), set_proxy_with_sequence(), set_proxy_with_solid(), or set_proxy_with_placeholder().

selected

selected: bool

When True, this item is selected. Read-only.

Note

Item selection is not stored in the .aep binary format; it is a runtime-only state. Parsed projects always report False.

time

time: float

The current time of the item when it is being previewed directly from the Project panel. This value is a number of seconds. It is an error to set this value for a FootageItem whose main_source or proxy_source is still.

type_name

type_name: str

A user-readable name for the item type ("Folder", "Footage" or "Composition"). These names are application locale-dependent, meaning that they are different depending on the application's UI language. Read-only.

use_proxy

use_proxy = ChunkField[bool](
    "_idta",
    "use_proxy",
    validate=_validate_use_proxy,
    post_set=_sync_proxy_active,
)

When True, a proxy is used for the item. Read / Write.

It is set to True by all the set_proxy methods, and to False by the set_proxy_to_none() method.

used_in

used_in: list[CompItem]

All the compositions that use this AVItem.

width

width: int

The width of the item in pixels. Read-only.

Functions

add_guide

add_guide(orientation_type: int, position: int) -> int

Adds a new guide to the item.

Any orientation_type value other than 0 (horizontal) or 1 (vertical) defaults to horizontal.

Parameters:

  • orientation_type (int) –

    0 for horizontal, 1 for vertical.

  • position (int) –

    The pixel position of the guide.

Returns:

  • int

    The index of the new guide.

remove

remove() -> None

Remove this AV item, its referencing layers, and viewer.

remove_guide

remove_guide(guide_index: int) -> None

Removes an existing guide by index.

Parameters:

  • guide_index (int) –

    The 0-based index of the guide to remove.

Raises:

set_proxy_to_none

set_proxy_to_none() -> None

Remove the proxy source from this item.

set_proxy_with_placeholder

set_proxy_with_placeholder(
    name: str | None,
    width: int,
    height: int,
    frame_rate: float,
    duration: float,
) -> None

Set a placeholder as the proxy source.

Parameters:

  • name (str | None) –

    The placeholder name. None becomes Missing Name. An empty string becomes Placeholder.

  • width (int) –

    Width in pixels (4-30000).

  • height (int) –

    Height in pixels (4-30000).

  • frame_rate (float) –

    Frame rate in fps (1.0-99.0).

  • duration (float) –

    Duration in seconds (> 0, <= 10800).

set_proxy_with_solid

set_proxy_with_solid(
    color: list[float],
    name: str | None,
    width: int,
    height: int,
    pixel_aspect: float = 1.0,
) -> None

Set a solid as the proxy source.

Parameters:

  • color (list[float]) –

    Solid color as [R, G, B] in 0.0-1.0 range.

  • name (str | None) –

    The solid name. Pass None to auto-generate a name from the color (e.g. Red Solid 1). An empty string becomes ????.

  • width (int) –

    Width in pixels (1-30000).

  • height (int) –

    Height in pixels (1-30000).

  • pixel_aspect (float, default: 1.0 ) –

    Pixel aspect ratio (0.01-100.0).