Implements the ST 291 ancillary data syntax

Usage no npm install needed!

<script type="module">
  import astronautlabsSt291 from 'https://cdn.skypack.dev/@astronautlabs/st291';



npm CircleCI

📜 ST 291-1:2011
Ancillary Data Packet and Space Formatting

📺 Part of the Astronaut Labs Broadcast Suite
@/is04 | @/rfc8331 | @/rtp | @/scte104 | @/scte35 | @/st2010 | @/st291

Release Quality
This library is ready for production

Implementation of ST 291 in Typescript using @astronautlabs/bitstream


This library provides the ability to read and write SMPTE ST 291 ancillary messages as they appear within the Vertical Ancillary space or other appropriate carriers. It implements 10-bit data words, parity and checksumming to ease implementations. ST 291 packets are used to send various types of data alongside video essence, notably captions, digital cue points, and AFD information.


npm install @astronautlabs/st291


This library exposes an element class called Packet that implements the syntax for ST291 packets. You can use BitstreamReader and BitstreamWriter from that package along with this class in order to read and write the packets. For quick usage, you can use serialize/deserialize:

import * as ST291 from '@astronautlabs/st291';

// read
let packet = await ST291.Packet.deserialize(buffer);

// write
buffer = packet.serialize();

The package also exposes parity() for computing 2-bit parity on an 8-bit data byte and checksum() for computing the 9-bit checksum on a set of 10-bit user data words.