# captions.js documentation (full) > All captions.js guide and API reference pages in one file. Index: https://captionsjs.dev/llms.txt ## Introduction > Welcome to the captions.js developer documentation. Use the sidebar to explore the full API reference and learn how to embed animated captions into your video workflow. ```ts import captionsjs, { stylePresets } from "captions.js"; const instance = captionsjs({ video: document.querySelector("video")!, preset: stylePresets[0], captions: [ { word: "Hello", startTime: 0, endTime: 0.4 }, { word: "world", startTime: 0.4, endTime: 0.9 }, ], }); instance.enable(); ``` Source: https://captionsjs.dev/docs --- ## Docker Render Service `maskin25/captions.js-render` is a ready-to-run container that burns captions onto a video using the **captions.js** renderer plus ffmpeg. This page shows how to pull the image, feed it your assets, and customize the render through CLI flags. ## 1. Pull the image ```bash docker pull maskin25/captions.js-render:latest ``` Tags follow the npm package version (`0.1.0`, `0.2.0`, …). Use a fixed tag in production. ## 2. Provide inputs The container expects: | Flag | Description | Example | | --------------------------------- | -------------------------------------------------------------------------------------------------------------------- | --------------------------------- | | `--preset ` | Name of the captions style preset (e.g. `Lovly`, `From`). See the [stylePresets](/docs/api/type-aliases/StylePresetName). | `--preset Lovly` | | `--video ` | Source video file. Supports `@/path` for mounted files or full HTTP(S) URLs. | `--video @/data/margo.mp4` | | `--captions ` | Captions payload. Accepts JSON string, mounted file, or remote URL. | `--captions @/data/margo-dg.json` | | `--output ` | Where to save the rendered video inside the container. Defaults to `/app/output.mp4`. | `--output @/data/output.mp4` | | `--rootDir ` | Convenience flag: if set, any argument starting with `@/` will be resolved relative to this directory. | `--rootDir /data` | All paths that start with `@/` are interpreted relative to the bind mount supplied via `-v`. This lets you keep videos/captions on the host. ## 3. Typical local run ```bash docker run --rm \ -v /absolute/path/to/assets:/data \ maskin25/captions.js-render:latest \ burnCaptions \ --preset Lovly \ --rootDir /data \ --video @/video.mp4 \ --captions @/captions.json \ --output @/output.mp4 ``` - `/absolute/path/to/assets` must contain both `video.mp4` and `captions.json`. - The resulting `output.mp4` is written back into the same host folder. ## 4. Remote assets The CLI can download files directly: ```bash docker run --rm maskin25/captions.js-render \ burnCaptions \ --preset From \ --rootDir /data \ --video https:// \ --captions https:// \ --output /app/output.mp4 ``` After the run, copy the result out with `docker cp :/app/output.mp4 ./output.mp4` or mount a host directory via `-v` so the file lands on disk automatically. Source: https://captionsjs.dev/docs/server --- ## captions.js vs Remotion, ASS/libass and FFmpeg drawtext > How the common ways to render animated captions compare: live preview, server-side burn-in, headless browser, word-level animation. Most caption tools make you choose between a good **live preview** and a reliable **server-side export**. This page compares the usual options on the points that decide which one fits. | | captions.js | `@remotion/captions` | Remotion (full render) | ASS / libass | FFmpeg `drawtext` | | --- | --- | --- | --- | --- | --- | | Live preview over `