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¶
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_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
¶
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).
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 / Write.
Setting this moves the item into another folder. The item's binary
chunk block is relocated from the old folder's container to the end
of the new folder's container, and both folders' items lists are
updated.
Raises:
-
ValueError–If this is the root folder, or if moving a folder into itself or one of its own descendants.
-
TypeError–If the value is not a FolderItem.
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.
Functions¶
add_guide
¶
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:
-
IndexError–If
guide_indexis out of range.
set_proxy
¶
Sets a file as the proxy of this AVItem.
Loads the specified file into a new FileSource object, sets this as the value
of the proxy_source attribute, and sets use_proxy to true.
It does not preserve the interpretation parameters, instead using the user preferences.
This differs from setting a FootageItem's main_source, but both actions are
performed as in the user interface.
Note
Unlike ExtendScript, if the specified file has an unlabeled alpha channel, this method does not estimate the alpha interpretation.
Parameters:
Raises:
-
ValueError–If the extension is not a supported footage format.
-
NotImplementedError–If After Effects requires a format-specific
optiheader not implemented for this format.
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:
set_proxy_with_sequence
¶
Sets a sequence of files as the proxy of this AVItem, with the option of
forcing alphabetical order. Loads the specified file sequence into a new
FileSource object, sets this as the value of the proxy_source attribute, and
sets use_proxy to true.
It does not preserve the interpretation parameters, instead using the user preferences.
Note
Unlike ExtendScript, if the specified file has an unlabeled alpha channel, this method does not estimate the alpha interpretation.
Parameters:
-
file(str | PathLike[str]) –Path to a representative frame; sibling frames in the same folder are gathered into the sequence.
-
force_alphabetical(bool, default:False) –Order frames alphabetically rather than numerically.
Raises:
-
ValueError–If the extension is not a supported footage format.
-
NotImplementedError–If After Effects requires a format-specific
optiheader not implemented for this format.
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
Noneto 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).