# @svta/cml-608

> CTA-608/CEA-608 closed captioning functionality

Latest version **1.1.0** (published 2026-08-13) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install @svta/cml-608
pnpm add @svta/cml-608
yarn add @svta/cml-608
bun add @svta/cml-608
```

## Health

**Score 65/100 (B)** — status: active.

Positive: esm support; no vulnerabilities; has provenance; recently updated; high maintenance score.

Warnings: low downloads; no types.

## Facts

| | |
|---|---|
| Version | 1.1.0 |
| Published | 2026-08-13 |
| First published | 2025-10-08 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | none |
| Module format | ESM |
| Node | >=20 |
| Dependencies | 0 |
| Unpacked size | 171.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 84 |
| Maintainers | littlespex, jason_n_thibeault |
| Keywords | Common Media Library, CML, CTA-608, CEA-608, EIA-608, closed captions, subtitles |

## Links

- npm: https://www.npmjs.com/package/@svta/cml-608
- Repository: https://github.com/streaming-video-technology-alliance/common-media-library
- Homepage: https://github.com/streaming-video-technology-alliance/common-media-library/tree/main/libs/608
- Issues: https://github.com/streaming-video-technology-alliance/common-media-library/issues
- npm.io page: https://npm.io/package/@svta/cml-608

## Recent versions

- 1.1.0 (latest) — 2026-08-13
- 1.0.3 — 2026-07-22
- 1.0.2 — 2026-02-17
- 1.0.1 — 2025-12-22
- 1.0.0 — 2025-10-24
- 0.22.0 — 2025-10-23
- 0.21.0 — 2025-10-21
- 0.20.0 — 2025-10-14
- 0.19.0 — 2025-10-08

## README

# @svta/cml-608

CTA-608/CEA-608 closed captioning functionality.

## Installation

```bash
npm i @svta/cml-608
```

## Usage

```typescript
import { CaptionScreen, Row } from "@svta/cml-608";
```

### Extracting captions from a media sample

CTA-608 captions ride inside the video elementary stream as an ATSC A/53 `cc_data()`
payload. The payload is the same for every codec; only the envelope around it differs, so
pick the extractor that matches the sample entry type:

| Sample entry            | Envelope                          | Extractor                          |
| ----------------------- | --------------------------------- | ---------------------------------- |
| `avc1` / `hvc1` / `vvc1` | `itu_t_t35` SEI message in a NAL  | `extractCta608DataFromSample`      |
| `av01`                  | `metadata_itu_t_t35` OBU          | `extractCta608DataFromAv1Sample`   |

Both return the same `[field1, field2]` byte arrays, which `Cta608Parser` turns into
rendered caption screens:

```typescript
import { Cta608Parser, extractCta608DataFromAv1Sample } from "@svta/cml-608";

const parser = new Cta608Parser(1, {
	newCue(startTime, endTime, screen) {
		console.log(startTime, endTime, screen.getDisplayText());
	},
}, null);

const [field1] = extractCta608DataFromAv1Sample(view, samplePos, sampleSize);
if (field1.length) {
	parser.addData(sampleTimeMs, field1);
}
```

These are separate functions rather than one auto-detecting call because the two carriages
are framed differently and neither sample announces which it is. A NAL unit sample puts a
fixed-width big-endian length in front of each unit, and that width is only known from
`lengthSizeMinusOne` in the `avcC`/`hvcC` config. An AV1 sample uses the low-overhead
format, where each OBU carries its own `obu_size` after the header — and may omit it on
the last OBU. Either way the framing has to come from the sample entry, so pass the bytes
to the extractor that matches it.

---
_Source: https://npm.io/package/@svta/cml-608 · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
