module Fluorite::Docs::C_DSL::FLUENT_DSL

Overview

Fluent Block and Chainable DSL

Fluorite replaces complex argument arrays and shell concatenations with a type-safe, fluent Crystal DSL. The DSL supports both lexical block structures (Fluorite.build do ... end) and chainable builders (Fluorite.input(...)).

Executive Summary & Key Topics

Topic Method / Anchor Description
Block-Scoped DSL .topic_01_block_dsl Building pipelines with scoped video, audio, and filter blocks.
Filter Graph Construction .topic_02_filter_graphs Chaining video and audio filters effortlessly.

Related Guides & Source References

Defined in:

fluorite/docs/c_dsl/fluent_dsl.cr

Class Method Summary

Class Method Detail

def self.topic_01_block_dsl : Nil #

Block-Scoped DSL: Building pipelines with scoped video, audio, and filter blocks.

cmd = Fluorite.build do
  overwrite!
  hwaccel :cuda # Enables NVIDIA hardware acceleration if available

  input("source.mov") do
    seek 10.seconds
    duration 45.seconds
  end

  video do
    codec :h264
    crf 19
    preset :slow
    scale 1920, 1080
    fps 60
  end

  audio do
    codec :aac
    bitrate "192k"
  end

  output("web_master.mp4") do
    faststart!
  end
end

cmd.run

def self.topic_02_filter_graphs : Nil #

Filter Graph Construction: Chaining video and audio filters effortlessly.

Use the built-in filter helpers for scaling, cropping, text drawing, and volume adjustments:

cmd = Fluorite.build do
  input("video.mp4")
  filter do
    crop 1280, 720, x: 0, y: 0
    drawtext text: "Fluorite Watermark", fontsize: 24, fontcolor: "white@0.8", x: 10, y: 10
    loudnorm i: -24.0, lra: 7.0 # Broadcast standard loudness normalization
  end
  output("out.mp4")
end