captionbob docs

Version 1.0.0
Contents ↓

Python: captionbob.plugins

captionbob.plugins.border_frame_progress_bar

Border frame progress bar plugin for the whole video.

The bar starts in the bottom left corner. It goes up the left edge, across the top edge, down the right edge and back along the bottom edge. Its tip moves at one speed, so a long edge takes more of the video time than a short edge. A finished edge stays visible.

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/border_frame_progress_bar.py

Settings

The command line and the HTTP API call this plugin border_frame_progress_bar. Its settings class is BorderFrameProgressBarSettings. Each setting has the default below.

Setting Type Default Description
color string "#00E5FF" Color of the bar and of its glow, as "#RRGGBB".
thickness integer 14 Thickness 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.

BorderFrameProgressBarSettings

@dataclass(frozen=True)
class BorderFrameProgressBarSettings

The look of the border frame progress bar.

Args:

  • color: Color of the bar and of its glow, as "#RRGGBB".
  • thickness: Thickness 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".

BorderFrameProgressBarPlugin

class BorderFrameProgressBarPlugin
    def __init__(self, settings: BorderFrameProgressBarSettings) -> None

Builds the ffmpeg filter text that draws the border frame progress bar.

Args:

  • settings: The look of the bar.

BorderFrameProgressBarPlugin.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 two bars do not fit in the shorter side of the video.