TsOutputSettings interface

Signature:

export interface TsOutputSettings

Properties

Property Type Description

audioFramesPerPes?

number

(Optional) PES packing of audio frames (where applicable). Lower values reduce audio latency, but increase bandwidth due to encapsulation overhead. Minimum 1, applicable maximum bounded by the byte size of a PES packet. If omitted the default is 16.

The packing is an upper bound, not the cadence: audio is also released whenever its oldest frame is pcrDelayMs (default 500 ms) old. With the default packing a 48 kHz AAC stream is sent in bursts of 16 frames (about 341 ms); a 32 kHz one reaches the 500 ms limit first. Set 1 for one frame per PES, which is the lowest latency and the only setting at which the simple encoder repeats PCR often enough for TR 101 290; see also TsOutputSettings.flushPartialPackets for the send side.

cta708Charset?

Cta708CharsetSetting

(Optional) Character set used when emitting CTA-708 P16 (16-bit) captions — for producing East-Asian captions in a legacy DBCS rather than Unicode. Does not affect Latin/ASCII text. Defaults to 'unicode'.

encoder?

TsEncoderSettings

(Optional) TS encoder settings. A broadcast encode specifies a bitrate and will produce a stream with accurate PCR spacing, null padding etc. A simple encode (default) is acceptable for many use cases.

flushPartialPackets?

boolean

(Optional) Send each chunk’s leftover TS packets immediately instead of holding them back until there are enough to fill a whole 7 × 188 = 1316-byte payload.

By default an output only ever hands the socket full 1316-byte payloads, so the last few packets of a chunk wait for the next one — and on a stream with a low byte rate, waiting for 1316 bytes takes a while. On audio-only output at 128 kbps it is about 70 ms, whatever TsOutputSettings.audioFramesPerPes is set to, because the wait is for bytes and not for frames. Setting this to true removes that delay: the tail goes out at the end of every chunk as a shorter payload, still a whole number of 188-byte TS packets. The cost is the extra per-payload headers (under 1% of bandwidth) and payloads that are not all the same size, which a receiver expecting exactly 1316 bytes may not like.

Worth setting on a low-bitrate or audio-only output where latency matters; there is little to gain on a stream with real video bitrate, where 1316 bytes arrive in a millisecond or two anyway.

Only valid with the simple encoder — the broadcast encoder has already paced the stream to a constant rate, so there is nothing waiting, and configuring both is rejected. Has no effect on fileTs, which does not queue. Defaults to false.

pmtPid?

number

(Optional) Pid to assign as PMT pid (for the first program, if there are multiple), if unspecified a default pid will be chosen