Python: captionbob.plugins
captionbob.plugins.progress_bar
Progress bar plugin for the whole video.
The plugin draws nothing itself. It builds the text of an ffmpeg filter graph, and ffmpeg draws the bar in the same pass that encodes the video.
Source file: captionbob/plugins/progress_bar.py
Settings
The command line and the HTTP API call this plugin progress_bar. Its settings class is ProgressBarSettings. Each setting has the default below.
| Setting | Type | Default | Description |
|---|---|---|---|
color |
string | "#00E5FF" |
Color of the bar and of its glow, as "#RRGGBB". |
height |
integer | 14 |
Height of the bar in pixels. |
glow_radius |
number | 10.0 |
Size of the glow in pixels. 0 gives a bar with no glow. |
glow_strength |
number | 2.0 |
How strong the glow is. 1.0 is the plain blur, and a higher value makes the glow brighter. |
ProgressBarSettings
@dataclass(frozen=True)
class ProgressBarSettings
The look of the progress bar.
Args:
color: Color of the bar and of its glow, as "#RRGGBB".height: Height of the bar in pixels.glow_radius: Size of the glow in pixels. 0 gives a bar with no glow.glow_strength: How strong the glow is. 1.0 is the plain blur, and a higher value makes the glow brighter.
Raises:
ValueError: When a value is outside its range or the color is not in the form "#RRGGBB".
ProgressBarPlugin
class ProgressBarPlugin
def __init__(self, settings: ProgressBarSettings) -> None
Builds the ffmpeg filter text that draws the progress bar.
The bar sits on the bottom edge of the video. Its length is the part of the video that has played: empty at the start, the full width at the end.
Args:
settings: The look of the bar.
ProgressBarPlugin.build_filter_graph
def build_filter_graph(self, video: VideoInfo, input_label: str,
output_label: str) -> str
Build the ffmpeg filter graph text that draws the bar on one video.
Args:
video: The frame size, the frame rate and the duration of the video.input_label: Label of the video stream to draw on, without brackets. Example: "0:v".output_label: Label that the result gets, without brackets.
Returns:
The filter graph text for the ffmpeg option -filter_complex.
Raises:
ValueError: When a label is empty, or when the bar height is not less than the video height.