captionbob docs

Version 1.0.0
Contents ↓

Python: captionbob.plugins

captionbob.plugins.dual_corner_trail_progress_bar

Dual corner trail progress bar plugin for the whole video.

Two bars start in the bottom left corner at the start of the video. The first bar goes up the left edge and then across the top edge. The second bar goes across the bottom edge and then up the right edge. The two tips move at the same speed, and both reach the top right corner at the end of the video. A finished edge stays visible.

The plugin draws nothing itself. It builds the text of an ffmpeg filter graph, and ffmpeg draws the bars in the same pass that encodes the video.

Source file: captionbob/plugins/dual_corner_trail_progress_bar.py

Settings

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

Setting Type Default Description
color string "#00E5FF" Color of the two bars and of their glow, as "#RRGGBB".
thickness integer 14 Thickness of each bar in pixels.
glow_radius number 10.0 Size of the glow in pixels. 0 gives bars 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.

DualCornerTrailProgressBarSettings

@dataclass(frozen=True)
class DualCornerTrailProgressBarSettings

The look of the dual corner trail progress bar.

Args:

  • color: Color of the two bars and of their glow, as "#RRGGBB".
  • thickness: Thickness of each bar in pixels.
  • glow_radius: Size of the glow in pixels. 0 gives bars 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".

DualCornerTrailProgressBarPlugin

class DualCornerTrailProgressBarPlugin
    def __init__(self, settings: DualCornerTrailProgressBarSettings) -> None

Builds the ffmpeg filter text that draws the two corner trail bars.

Args:

  • settings: The look of the bars.

DualCornerTrailProgressBarPlugin.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 bars 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.