Timeline#

class pybmd.timeline.Timeline(timeline)[source]

Bases: object

Timeline Object

Methods

__init__(timeline)

add_marker(frame_id, color, name, note, ...)

Creates a new marker at given frameId position and with given marker information.

add_track(track_type, track_options)

Adds track of trackType ("video", "subtitle", "audio").

analyze_dolby_vision([timeline_item_list, ...])

Analyzes Dolby Vision on clips present on the timeline.

clear_mark_in_out([mark_type])

Clears mark in/out points from the timeline.

convert_timeline_to_stereo()

Converts timeline to stereo.

create_compound_clip(timeline_items, clipinfo)

Creates a compound clip of input TimelineItems with an optional clipInfo map

create_fusion_clip(timeline_items)

Creates a Fusion clip of input timeline items.

create_subtitles_from_audio(...)

Creates subtitles from audio for the timeline.

delete_clips(timeline_items[, ripple_delete])

Deletes specified TimelineItems from the timeline

delete_marker_at_frame(frame_num)

Deletes the timeline marker at the given frame number.

delete_marker_by_color(color)

Deletes all timeline markers of the specified color.

delete_marker_by_custom_data(custom_data)

Delete first matching marker with specified custom_data.

delete_track(track_type, track_index)

Deletes track of trackType ("video", "subtitle", "audio") and given trackIndex.

detect_scene_cuts()

Detects and makes scene cuts along the timeline.

duplicate_timeline(timeline_name)

Duplicates the timeline and returns the created timeline, with the (optional) timelineName, on success.

export(file_name, export_type[, export_subtype])

Exports timeline to 'fileName' as per input exportType & exportSubtype format.

get_current_clip_thumbnail_image()

Returns a dict (keys "width", "height", "format" and "data") with data containing raw thumbnail image data (RGB 8-bit image data encoded in base64 format) for current media in the Color Page.

get_current_timecode()

Returns a string timecode representation for the current playhead position, while on Cut, Edit, Color, Fairlight and Deliver pages.

get_current_video_item()

Returns the current video timeline item.

get_end_frame()

Returns the frame number at the end of timeline.

get_is_track_enabled(track_type, track_index)

get_is_track_locked(track_type, track_index)

Returns True if track with given trackType and trackIndex is locked and False otherwise.

get_item_list_in_track(track_type, index)

Returns a list of timeline items on that track.

get_mark_in_out()

Gets the in/out marks set on the timeline.

get_marker_by_custom_data(custom_data)

Returns marker {information} for the first matching marker with specified customData.

get_marker_custom_data(frame_id)

Returns customData string for the marker at given frameId position.

get_markers()

Returns a dict (frameId -> {information}) of all markers and dicts with their information.

get_media_pool_item()

get_name()

Returns the name of the timeline.

get_node_graph()

Returns the timeline's node graph object.

get_setting([setting_name])

Returns value of timeline setting (indicated by settingName : string).

get_start_frame()

Returns the frame number at the start of timeline.

get_start_timecode()

Returns the start timecode for the timeline.

get_track_count(track_type)

Returns the number of tracks for the given trackType ("audio", "video" or "subtitle").

get_track_name(track_type, track_index)

Returns the track name for track indicated by trackType ("audio", "video" or "subtitle") and trackIndex.

get_track_sub_type(track_index[, track_type])

_summary_

get_unique_id()

Returns a unique ID for the timeline

get_voice_isolation_state(track_index)

Returns the Voice Isolation State for the given audio track.

grab_all_stills(still_frame_source)

Grabs stills from all the clips of the timeline and returns a list of GalleryStill objects.

grab_still()

Grabs still from the current video clip.

import_into_timeline(file_path, import_options)

Imports timeline items from an AAF file and optional importOptions dict into the timeline,

insert_fusion_composition_into_timeline()

Inserts a Fusion composition into the timeline.Returns a TimelineItem object.

insert_fusion_generator_into_timeline(...)

Inserts a Fusion generator (indicated by generatorName : string) into the timeline.

insert_fusion_title_into_timeline(title_name)

Inserts a Fusion title (indicated by titleName : string) into the timeline.

insert_generator_into_timeline(generator_name)

Inserts a generator (indicated by generatorName : string) into the timeline.

insert_oFX_generator_into_timeline(...)

Inserts an OFX generator (indicated by generatorName : string) into the timeline.

insert_title_into_timeline(title_name)

Inserts a title (indicated by titleName : string) into the timeline.

set_clips_linked(timeline_items, is_linked)

Links or unlinks the specified TimelineItems depending on second argument.

set_current_timecode(tiemcode)

Sets current playhead position from input timecode for Cut, Edit, Color, Fairlight and Deliver pages.

set_mark_in_out(mark_in, mark_out[, mark_type])

Sets mark in/out points on the timeline.

set_name(timeline_name)

Sets the timeline name if timelineName (string) is unique.

set_setting(setting_name, setting_value)

Sets timeline setting

set_start_timecode(timecode)

Set the start timecode of the timeline to the string 'timecode'.

set_track_enable(track_type, track_index, ...)

Enables/Disables track with given trackType and trackIndex

set_track_lock(track_type, track_index, ...)

Locks/Unlocks track with given trackType and trackIndex

set_track_name(track_type, track_index, name)

Sets the track name (string) for track indicated by trackType and trackIndex.

set_voice_isolation_state(track_index, ...)

Sets Voice Isolation state of audio track with given track index.

update_marker_custom_data(frame_id, custom_data)

Updates customData (string) for the marker at given frameId position.

add_marker(frame_id: str, color: str, name: str, note: str, duration: str, custom_data: str) bool[source]

Creates a new marker at given frameId position and with given marker information.

Parameters:
  • frame_id (str) – frame position of the marker.

  • color (str) – color of the marker.

  • name (str) – name of the marker.

  • note (str) – note of the marker.

  • duration (str) – duration of the marker.

  • custom_data (str) – custom data of the marker.helps to attach user specific data to the marker.

Returns:

True if successful, False otherwise.

Return type:

bool

create_compound_clip(timeline_items: List[TimelineItem], clipinfo: dict) TimelineItem[source]

Creates a compound clip of input TimelineItems with an optional clipInfo map

Parameters:
  • timeline_items (List[TimelineItem]) – TimelineItems to create compound clip from.

  • clipinfo (dict) – {“startTimecode” : “00:00:00:00”, “name” : “Compound Clip 1”}.

Returns:

created timeline item.

Return type:

TimelineItem

create_fusion_clip(timeline_items: List[TimelineItem]) TimelineItem[source]

Creates a Fusion clip of input timeline items.

Parameters:

timeline_items (List[TimelineItem]) – timeline items to create fusion clip from.

Returns:

created timeline item.

Return type:

TimelineItem

delete_marker_at_frame(frame_num: int) bool[source]

Deletes the timeline marker at the given frame number.

Parameters:

frame_num (int)

Return type:

bool

delete_marker_by_custom_data(custom_data: str) bool[source]

Delete first matching marker with specified custom_data.

Parameters:

custom_data (str)

Return type:

bool

delete_marker_by_color(color: str) bool[source]

Deletes all timeline markers of the specified color. An “All” argument is supported and deletes all timeline markers.

Parameters:

color (str)

Return type:

bool

duplicate_timeline(timeline_name: str) pybmd.timeline.Timeline[source]

Duplicates the timeline and returns the created timeline, with the (optional) timelineName, on success.

Parameters:

timeline_name (str)

Return type:

pybmd.timeline.Timeline

export(file_name: str, export_type: Timeline_Export_Type, export_subtype: Timeline_Export_Subtype = None) bool[source]

Exports timeline to ‘fileName’ as per input exportType & exportSubtype format.

# file_name should be a path, not a file name.

# eg. file_path=os.path.join(os.path.expanduser(“~”), “Desktop/Temp/sampleExp.drt”)

# timeline.export(file_path,LOCAL_RESOLVE.EXPORT_DRT)

Parameters:
  • file_name (str)

  • export_type (Timeline_Export_Type)

  • export_subtype (Timeline_Export_Subtype)

Return type:

bool

get_current_clip_thumbnail_image() dict[source]

Returns a dict (keys “width”, “height”, “format” and “data”) with data containing raw thumbnail image data (RGB 8-bit image data encoded in base64 format) for current media in the Color Page.

Return type:

dict

get_current_timecode() str[source]

Returns a string timecode representation for the current playhead position, while on Cut, Edit, Color, Fairlight and Deliver pages.

Return type:

str

get_current_video_item() TimelineItem[source]

Returns the current video timeline item.

Return type:

TimelineItem

get_end_frame() int[source]

Returns the frame number at the end of timeline.

Return type:

int

get_item_list_in_track(track_type: TrackType, index: int) List[TimelineItem][source]

Returns a list of timeline items on that track.

Parameters:
  • track_type (TrackTpye) – track type.

  • index (int) – track index.

Returns:

timeline items on that track.

Return type:

List[TimelineItem]

get_marker_by_custom_data(custom_data: str) dict[source]

Returns marker {information} for the first matching marker with specified customData.

Parameters:

custom_data (str)

Return type:

dict

get_marker_custom_data(frame_id: int) str[source]

Returns customData string for the marker at given frameId position.

Parameters:

frame_id (int)

Return type:

str

get_markers() dict[source]

Returns a dict (frameId -> {information}) of all markers and dicts with their information. Example: a value of {96.0: {‘color’: ‘Green’, ‘duration’: 1.0, ‘note’: ‘’, ‘name’: ‘Marker 1’, ‘customData’: ‘’}, …} indicates a single green marker at timeline offset 96

Return type:

dict

get_name() str[source]

Returns the name of the timeline.

Return type:

str

get_setting(setting_name: str = '') str[source]

Returns value of timeline setting (indicated by settingName : string).

Parameters:

setting_name (str)

Return type:

str

get_start_frame() int[source]

Returns the frame number at the start of timeline.

Return type:

int

get_track_count(track_type: TrackType) int[source]

Returns the number of tracks for the given trackType (“audio”, “video” or “subtitle”).

Parameters:

track_type (TrackType)

Return type:

int

get_track_name(track_type: TrackType, track_index: int) str[source]

Returns the track name for track indicated by trackType (“audio”, “video” or “subtitle”) and trackIndex.

Parameters:
  • track_type (TrackTpye) – Track type.

  • track_index (int) – 1 <= trackIndex <= GetTrackCount(trackType)

Returns:

track name.

Return type:

str

grab_all_stills(still_frame_source: int) List[GalleryStill][source]

Grabs stills from all the clips of the timeline and returns a list of GalleryStill objects.

Parameters:

still_frame_source (int) – 1 - First frame, 2 - Middle frame

Returns:

List of GalleryStill objects containing grabbed stills.

Return type:

List[GalleryStill]

grab_still() GalleryStill[source]

Grabs still from the current video clip. Returns a GalleryStill object.

Return type:

GalleryStill

import_into_timeline(file_path: str, import_options: ImportOptions) bool[source]

Imports timeline items from an AAF file and optional importOptions dict into the timeline,

Parameters:
  • file_path (str) – file path.

  • import_options (ImportOptions) – ImportOptions object.

Returns:

true if successful, false otherwise.

Return type:

bool

insert_fusion_generator_into_timeline(generator_name: str) TimelineItem[source]

Inserts a Fusion generator (indicated by generatorName : string) into the timeline.

Parameters:

generator_name (str)

Return type:

TimelineItem

insert_fusion_title_into_timeline(title_name: str) TimelineItem[source]

Inserts a Fusion title (indicated by titleName : string) into the timeline.

Parameters:

title_name (str)

Return type:

TimelineItem

insert_generator_into_timeline(generator_name: str) TimelineItem[source]

Inserts a generator (indicated by generatorName : string) into the timeline.

Parameters:

generator_name (str)

Return type:

TimelineItem

insert_oFX_generator_into_timeline(generator_name: str) TimelineItem[source]

Inserts an OFX generator (indicated by generatorName : string) into the timeline.

Parameters:

generator_name (str)

Return type:

TimelineItem

insert_title_into_timeline(title_name: str) TimelineItem[source]

Inserts a title (indicated by titleName : string) into the timeline.

Parameters:

title_name (str)

Return type:

TimelineItem

set_current_timecode(tiemcode: str) bool[source]

Sets current playhead position from input timecode for Cut, Edit, Color, Fairlight and Deliver pages.

Parameters:

tiemcode (str)

Return type:

bool

set_name(timeline_name) bool[source]

Sets the timeline name if timelineName (string) is unique. Returns True if successful.

Return type:

bool

set_setting(setting_name: str, setting_value: str) bool[source]

Sets timeline setting

Parameters:
  • setting_name (str) – Setting name.

  • setting_value (str) – Setting value.

Returns:

True if successful, False otherwise.

Return type:

bool

set_track_name(track_type: TrackType, track_index: int, name: str) bool[source]

Sets the track name (string) for track indicated by trackType and trackIndex.

Parameters:
  • track_type (TrackTpye) – TrackType object.

  • track_index (int) – 1 <= trackIndex <= GetTrackCount(trackType).

  • name (str) – track name.

Returns:

True if successful, False otherwise.

Return type:

bool

update_marker_custom_data(frame_id: int, custom_data: str) bool[source]

Updates customData (string) for the marker at given frameId position. CustomData is not exposed via UI and is useful for scripting developer to attach any user specific data to markers.

Parameters:
  • frame_id (int)

  • custom_data (str)

Return type:

bool

set_start_timecode(timecode: str) bool[source]

Set the start timecode of the timeline to the string ‘timecode’. Returns true when the change is successful, false otherwise.

Parameters:

timecode (str)

Return type:

bool

get_start_timecode() str[source]

Returns the start timecode for the timeline.

Return type:

str

insert_fusion_composition_into_timeline() TimelineItem[source]

Inserts a Fusion composition into the timeline.Returns a TimelineItem object.

Return type:

TimelineItem

get_unique_id() str[source]

Returns a unique ID for the timeline

Return type:

str

add_track(track_type: TrackType, track_options: OptionalSubTrackType | Dict) bool[source]

Adds track of trackType (“video”, “subtitle”, “audio”). Second argument optionalSubTrackType is required for “audio”

Parameters:
  • track_type (TrackType) – track type

  • track_options (OptionalSubTrackType|Dict) – Second argument is required for “audio” ,it can be newTrackOptions dict or OptionalSubTrackType, newTrackOptions dict = {‘audioType’: same as subTrackType above, ‘index’: 1 <= index <= GetTrackCount(trackType)}

Returns:

True if successful, False otherwise.

Return type:

bool

delete_track(track_type: TrackType, track_index: int) bool[source]

Deletes track of trackType (“video”, “subtitle”, “audio”) and given trackIndex.

Parameters:
  • track_type (TrackType) – track type

  • track_index (int) – track index.1 <= track_index <= get_track_count(track_type).

Returns:

True if successful, False otherwise.

Return type:

bool

set_track_enable(track_type: TrackType, track_index: int, is_enable: bool) bool[source]

Enables/Disables track with given trackType and trackIndex

Parameters:
  • track_type (TrackType) – trackType is one of {“audio”, “video”, “subtitle”}

  • track_index (int) – 1 <= trackIndex < GetTrackCount(trackType).

  • is_enable (bool) – enable state

Returns:

True if successful, False otherwise.

Return type:

bool

get_is_track_enabled(track_type, track_index) bool[source]
Parameters:
  • track_type (_type_) – trackType is one of {“audio”, “video”, “subtitle”}

  • track_index (_type_) – 1 <= trackIndex <= GetTrackCount(trackType).

Returns:

Returns True if track with given trackType and trackIndex is enabled and False otherwise.

Return type:

bool

set_track_lock(track_type: TrackType, track_index: int, is_locked: bool) bool[source]

Locks/Unlocks track with given trackType and trackIndex

Parameters:
  • track_type (TrackType) – trackType is one of {“audio”, “video”, “subtitle”}

  • track_index (int) – 1 <= trackIndex <= GetTrackCount(trackType).

  • is_locked (bool) – lock state

Returns:

True if successful, False otherwise.

Return type:

bool

get_is_track_locked(track_type: TrackType, track_index: int) bool[source]

Returns True if track with given trackType and trackIndex is locked and False otherwise.

Parameters:
  • track_type (TrackType) – trackType is one of {“audio”, “video”, “subtitle”}

  • track_index (int) – 1 <= trackIndex <= GetTrackCount(trackType).

Returns:

Returns True if track with given trackType and trackIndex is locked and False otherwise.

Return type:

bool

delete_clips(timeline_items: List[TimelineItem], ripple_delete: bool = False) bool[source]

Deletes specified TimelineItems from the timeline

Parameters:
  • timeline_items (List[TimelineItem]) – specified TimelineItems

  • ripple_delete (bool) – performing ripple delete if the second argument is True.

Returns:

True if successful, False otherwise.

Return type:

bool

set_clips_linked(timeline_items: List[TimelineItem], is_linked: bool) bool[source]

Links or unlinks the specified TimelineItems depending on second argument.

Parameters:
  • timeline_items (List[TimelineItem]) – specified TimelineItems

  • is_linked (bool) – Links or unlinks the specified TimelineItems

Returns:

True if successful, False otherwise.

Return type:

bool

create_subtitles_from_audio(auto_caption_settings: AutoCaptionSettings) bool[source]

Creates subtitles from audio for the timeline.

Returns:

Returns True on success, False otherwise.

Return type:

bool

Parameters:

auto_caption_settings (AutoCaptionSettings)

detect_scene_cuts() bool[source]

Detects and makes scene cuts along the timeline.

Returns:

Returns True if successful, False otherwise.

Return type:

bool

convert_timeline_to_stereo() bool[source]

Converts timeline to stereo.

Returns:

Returns True if successful; False otherwise.

Return type:

bool

get_node_graph() Graph[source]

Returns the timeline’s node graph object.

Returns:

timeline’s node graph object.

Return type:

Graph

analyze_dolby_vision(timeline_item_list: List[TimelineItem] = [], analysis_type=None) bool[source]

Analyzes Dolby Vision on clips present on the timeline.

Parameters:
  • timeline_item_list (List[TimelineItem]) – if timeline_item_list is empty, analysis performed on all items. Else, analysis performed on timeline_item_list only.

  • () (analysis_type) – set analysisType to resolve.DLB_BLEND_SHOTS for blend setting

Returns:

Returns True if analysis start is successful; False otherwise.

Return type:

bool

get_track_sub_type(track_index: int, track_type: str = 'audio') str[source]

_summary_

Parameters:
  • track_index (int) – 1 < = track_index < = GetTrackCount(trackType)

  • track_type (str, optional) – Defaults to “audio”.

Returns:

audio track’s format,value is one of {“mono”, “stereo”, “5.1”, “5.1film”, “7.1”, “7.1film”, “adaptive1”, … , “adaptive24”}

Return type:

str

get_media_pool_item() MediaPoolItem[source]
Returns:

Returns the media pool item corresponding to the timeline

Return type:

MediaPoolItem

get_mark_in_out() dict[source]

Gets the in/out marks set on the timeline.

Returns:

Dictionary containing video/audio in/out marks. Example:
{

‘video’: {‘in’: 0, ‘out’: 134}, ‘audio’: {‘in’: 0, ‘out’: 134}

} Keys are omitted if marks are not set.

Return type:

dict

set_mark_in_out(mark_in: int, mark_out: int, mark_type: str = 'all') bool[source]

Sets mark in/out points on the timeline.

Parameters:
  • mark_in (int) – Frame number for in point

  • mark_out (int) – Frame number for out point

  • mark_type (str, optional) – Type of mark to set - “video”, “audio” or “all”. Defaults to “all”.

Returns:

True if successful, False otherwise

Return type:

bool

clear_mark_in_out(mark_type: str = 'all') bool[source]

Clears mark in/out points from the timeline.

Parameters:

mark_type (str, optional) – Type of marks to clear - “video”, “audio” or “all”. Defaults to “all”.

Returns:

True if successful, False otherwise

Return type:

bool

get_voice_isolation_state(track_index: int) dict[source]

Returns the Voice Isolation State for the given audio track.

Parameters:

track_index (int) – Track index. 1 <= track_index <= GetTrackCount(“audio”)

Returns:

Dictionary with keys {‘isEnabled’: bool, ‘amount’: int}.

amount is in range of [0, 100]

Return type:

dict

set_voice_isolation_state(track_index: int, voice_isolation_state: dict) bool[source]

Sets Voice Isolation state of audio track with given track index.

Parameters:
  • track_index (int) – Track index. 1 <= track_index <= GetTrackCount(“audio”)

  • voice_isolation_state (dict) – Dictionary with keys {‘isEnabled’: bool, ‘amount’: int}. amount must be in range of [0, 100]

Returns:

True if successful, False otherwise

Return type:

bool