video¶
Overview¶
Video is a class that helps to manage video files, be it a small video to be mixed or the final one. |
- |
Classes¶
- class video.Video(width: int = 512, height: int = 320)¶
Bases:
abc.ABCVideo is a class that helps to manage video files, be it a small video to be mixed or the final one.
it stores metadata about itself amd possibly sub-videos
Video is actually really generated when you do call the build method. This is an immutable operation, i.e. once built, you cannot rebuild or change the properties of the video object.
Overview
Methods¶ build(build_settings)Build in async but expose a sync interface
build_async(build_settings)Build the video in the child classes, unless the video is already built, in which case
Gather the handler chain and run it
Get the background music prompt from the video list.
get_core_handlers(build_settings)Get the core handlers for the video
Get the duration of the final video
get_file_name_by_state(build_settings)Get the file name of the video by its state
Get the first frame of the video
Get the last frame of the video
abc Returns the title of the video.
prepare_build(build_settings)Prepare the video for building, may be used to inject build settings for individual videos
run_build_core_logic_hook(build_settings)Run the core logic of the video building
run_post_build_actions_hook(build_settings)Post build actions hook
run_pre_build_actions_hook(build_settings)Pre build actions hook
set_final_video_name(output_file_name)Rename the video media file to the output_file_name if not already set
Members
- build(build_settings: vikit.video.video_build_settings.VideoBuildSettings = VideoBuildSettings())¶
Build in async but expose a sync interface
- async build_async(build_settings: vikit.video.video_build_settings.VideoBuildSettings = VideoBuildSettings())¶
Build the video in the child classes, unless the video is already built, in which case we just return ourselves (Video gets immutable once generated)
This is a template method, the child classes should implement the get_handler_chain method
- Parameters:
build_settings (VideoBuildSettings) -- The settings to use for building the video
- Returns:
The built video
- Return type:
- async gather_and_run_handlers()¶
Gather the handler chain and run it
- generate_background_music_prompt()¶
Get the background music prompt from the video list.
- Returns:
The background music prompt
- Return type:
- get_core_handlers(build_settings=None)¶
Get the core handlers for the video
- get_duration()¶
Get the duration of the final video
- Returns:
The duration of the final video
- Return type:
- get_file_name_by_state(build_settings: vikit.video.video_build_settings.VideoBuildSettings = None)¶
Get the file name of the video by its state
Shortcut method not to have to call the VideoFileName class directly
- async get_first_frame_as_image()¶
Get the first frame of the video
- async get_last_frame_as_image()¶
Get the last frame of the video
- abstract get_title()¶
Returns the title of the video.
- async prepare_build(build_settings: vikit.video.video_build_settings.VideoBuildSettings) Video¶
Prepare the video for building, may be used to inject build settings for individual videos that we don’t want to share with global buildsettings. For instance to generate a video a given way, and another video another way, all in the same composite video
- Parameters:
build_settings (VideoBuildSettings) -- The settings to use for building the video later on
- Returns:
The current instance, prepared for building
- Return type:
- async run_build_core_logic_hook(build_settings: vikit.video.video_build_settings.VideoBuildSettings)¶
Run the core logic of the video building
- Parameters:
build_settings (VideoBuildSettings) -- The settings to use for building the video
- async run_post_build_actions_hook(build_settings: vikit.video.video_build_settings.VideoBuildSettings)¶
Post build actions hook
- async run_pre_build_actions_hook(build_settings: vikit.video.video_build_settings.VideoBuildSettings)¶
Pre build actions hook
- Parameters:
build_settings (VideoBuildSettings) -- The settings to use for building the video
- set_final_video_name(output_file_name: str)¶
Rename the video media file to the output_file_name if not already set as the current media file.
Today this function only works for local files.
We fail open: in case no target file name works, we just keep the video as it is and where it stands. We send a warning to the logger though.
- Parameters:
output_file_name (str) -- The output file name
- Returns:
The video with the target file name
Attributes¶
- video.DEFAULT_VIDEO_TITLE = 'no-title-yet'¶