pyrit.prompt_converter.AddImageVideoConverter#

class AddImageVideoConverter(video_path: str, output_path: str | None = None, img_position: tuple = (10, 10), img_resize_size: tuple = (500, 500))[source]#

Bases: PromptConverter

Adds an image to a video at a specified position.

Currently the image is placed in the whole video, not at a specific timepoint.

__init__(video_path: str, output_path: str | None = None, img_position: tuple = (10, 10), img_resize_size: tuple = (500, 500))[source]#

Initializes the converter with the video path and image properties.

Parameters:
  • video_path (str) – File path of video to add image to.

  • output_path (str, Optional) – File path of output video. Defaults to None.

  • img_position (tuple) – Position to place image in video. Defaults to (10, 10).

  • img_resize_size (tuple) – Size to resize image to. Defaults to (500, 500).

Raises:

ValueError – If video_path is empty or invalid.

Methods

__init__(video_path[, output_path, ...])

Initializes the converter with the video path and image properties.

convert_async(*, prompt[, input_type])

Converts the given prompt (image) by adding it to a video.

convert_tokens_async(*, prompt[, ...])

Converts substrings within a prompt that are enclosed by specified start and end tokens.

get_identifier()

Returns an identifier dictionary for the converter.

input_supported(input_type)

Checks if the input type is supported by the converter.

output_supported(output_type)

Checks if the output type is supported by the converter.

Attributes

supported_input_types

Returns a list of supported input types for the converter.

supported_output_types

Returns a list of supported output types for the converter.

async convert_async(*, prompt: str, input_type: Literal['text', 'image_path', 'audio_path', 'video_path', 'url', 'reasoning', 'error'] = 'image_path') ConverterResult[source]#

Converts the given prompt (image) by adding it to a video.

Parameters:
  • prompt (str) – The image path to be added to the video.

  • input_type (PromptDataType) – The type of input data.

Returns:

The result containing filename of the converted video.

Return type:

ConverterResult

Raises:

ValueError – If the input type is not supported.

input_supported(input_type: Literal['text', 'image_path', 'audio_path', 'video_path', 'url', 'reasoning', 'error']) bool[source]#

Checks if the input type is supported by the converter.

Parameters:

input_type (PromptDataType) – The input type to check.

Returns:

True if the input type is supported, False otherwise.

Return type:

bool

output_supported(output_type: Literal['text', 'image_path', 'audio_path', 'video_path', 'url', 'reasoning', 'error']) bool[source]#

Checks if the output type is supported by the converter.

Parameters:

output_type (PromptDataType) – The output type to check.

Returns:

True if the output type is supported, False otherwise.

Return type:

bool