remotion-dev/remotion · error · Error

DTS is present but not PTS, this is not allowed in the spec

Error message

DTS is present but not PTS, this is not allowed in the spec

What it means

Thrown at parse-pes.ts:43 when the PTS_DTS_flags are '01' (DTS present but no PTS). ISO/IEC 13818-1 explicitly forbids this combination: a stream may have only PTS (flags=10), both PTS and DTS (flags=11), or neither (flags=00), but never DTS alone.

Source

Thrown at packages/media-parser/src/containers/transport-stream/parse-pes.ts:43

	iterator.startReadingBits();
	const markerBits = iterator.getBits(2);
	if (markerBits !== 0b10) {
		throw new Error(`Invalid marker bits: ${markerBits}`);
	}

	const scrambled = iterator.getBits(2);
	if (scrambled !== 0b00) {
		throw new Error(`Only supporting non-scrambled streams`);
	}

	const priority = iterator.getBits(1);
	iterator.getBits(1); // data alignment indicator
	iterator.getBits(1); // copy right
	iterator.getBits(1); // original or copy
	const ptsPresent = iterator.getBits(1);
	const dtsPresent = iterator.getBits(1);
	if (!ptsPresent && dtsPresent) {
		throw new Error(
			`DTS is present but not PTS, this is not allowed in the spec`,
		);
	}

	iterator.getBits(1); // escr flag
	iterator.getBits(1); // es rate flag
	iterator.getBits(1); // dsm trick mode flag
	iterator.getBits(1); // additional copy info flag
	iterator.getBits(1); // crc flag
	iterator.getBits(1); // extension flag
	const pesHeaderLength = iterator.getBits(8);
	const offsetAfterHeader = iterator.counter.getOffset();
	let pts: number | null = null;
	if (!ptsPresent) {
		throw new Error(`PTS is required`);
	}

	const fourBits = iterator.getBits(4);

View on GitHub (pinned to 78fe4bb3fd)

Solutions

  1. Re-mux the file with a conformant muxer (ffmpeg -i in.ts -c copy out.ts).
  2. Verify with dvbsnoop or ts2sec that PTS_DTS_flags are valid.
  3. Use a different source if the file is a damaged capture.
  4. File an upstream bug against the muxer if the corruption is reproducible.
Defensive patterns

Strategy: try-catch

Try / catch

try { await parseMedia({src}); }
catch (e) { if (e instanceof Error && e.message === 'DTS is present but not PTS, this is not allowed in the spec') { await runFfmpeg(['-i', src, '-c', 'copy', src + '.remux.ts']); await parseMedia({src: src + '.remux.ts'}); } else throw e; }

Prevention

When it happens

Trigger: parsePes reads ptsPresent and dtsPresent bits; if dtsPresent is true while ptsPresent is false, the spec violation is reported. Triggered by a malformed PES header, an encoder bug, or bit corruption in the flag field.

Common situations: Broken muxers that set PTS_DTS_flags incorrectly; corrupt captures; partial packets where the flag byte is incomplete.

Related errors


AI-assisted analysis of remotion-dev/remotion@78fe4bb3fd (2026-08-12). Data as JSON: /api/errors/6902c9f6e2e6bfd9. Report an issue: GitHub.