scholium.video_generator.VideoGenerator#

class VideoGenerator(resolution=(1920, 1080), fps=30, video_config=None)[source]#

Bases: object

Generates videos from slides and audio using ffmpeg.

Initialize video generator.

Parameters:
  • resolution (tuple) – Video resolution as (width, height).

  • fps (int) – Frames per second.

  • video_config (Optional[Dict[str, Any]]) – Optional video: config section. Recognised keys: codec, preset, crf, pixel_format, audio_codec, audio_bitrate, extra_args. Any unknown keys are ignored.

Methods

create_video

Create video from slides and audio segments.

probe_dependencies

Probe ffmpeg and verify configured codecs are available.

probe_dependencies()[source]#

Probe ffmpeg and verify configured codecs are available.

Mirrors SlideBackend.probe_dependencies() so the CLI’s video list doctor command can render the results identically.

Return type:

List[Probe]

create_video(slides, segments, output_path, temp_dir=None)[source]#

Create video from slides and audio segments.

Parameters:
  • slides (List[str]) – List of slide image paths

  • segments (List[Dict[str, Any]]) – List of segments with timing info: - audio_path: Path to audio file (None for silent) - audio_duration: Duration of audio - duration: Total duration (includes pre/post delays, respects min_duration) - pre_delay: Seconds to pause before audio - post_delay: Seconds to pause after audio - slide_number: Slide index (1-based) - fixed_duration: If set, overrides calculated duration

  • output_path (str) – Path for output video

  • temp_dir (str) – Directory for temporary files

Return type:

str

Returns:

Path to generated video

Raises:

RuntimeError – If video generation fails