Speech
Functionality for vizualization results from MediaCatch Speech API
Class to visualize speech results.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
file_path
|
str | Path
|
Path to file. |
required |
results
|
dict[str, Any]
|
Results from speech API. |
required |
output_path
|
str | Path
|
Output path. |
required |
subtitles
|
bool
|
If true, add subtitles. Defaults to True. |
True
|
meta
|
bool
|
If true, add meta data. Defaults to True. |
True
|
max_subtitle_length
|
int
|
Maximum length of subtitle. Defaults to 10. |
10
|
max_chars_in_subtitle
|
int
|
Maximum characters in subtitle. Defaults to 100. |
100
|
burn_subtitles(text_srt_file, meta_srt_file, stream=False)
Burn subtitles to video.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
text_srt_file
|
Path | None
|
Subtitles in SRT format. |
required |
meta_srt_file
|
Path | None
|
Meta data in SRT format. |
required |
stream
|
bool
|
Set text style to stream. Defaults to False. |
False
|
create_meta_subtitle(utterances)
Create meta subtitles.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
utterances
|
list[dict[str, Any]]
|
Utterances for speech results. |
required |
Returns:
Name | Type | Description |
---|---|---|
str |
str
|
Subtitles in SRT format. |
create_text_subtitle(utterances)
Create text subtitles.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
utterances
|
list[dict[str, Any]]
|
Utterances for speech results. |
required |
Returns:
Name | Type | Description |
---|---|---|
str |
str
|
Subtitles in SRT format. |
create_viz()
Create visualization.
write_srt_file(input_path, output_suffix, subtitles)
staticmethod
Write subtitles to file as SRT.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
input_path
|
str
|
Input path. |
required |
output_suffix
|
str
|
Output suffix. |
required |
subtitles
|
str
|
Subtitles in SRT format. |
required |
Returns:
Name | Type | Description |
---|---|---|
Path |
Path
|
Output path. |