remotion-dev/remotion · error · Error

Invalid section length

Error message

Invalid section length

What it means

Thrown at parse-pmt.ts:84 when the PMT section_length field (10 bits) exceeds 1021 bytes. Same ISO/IEC 13818-1 constraint as the PAT: section_length is capped at 1021 because the maximum section payload plus CRC must fit in 1024 bytes.

Source

Thrown at packages/media-parser/src/containers/transport-stream/parse-pmt.ts:84

	iterator.stopReadingBits();

	return {
		type: 'transport-stream-pmt-box',
		tableId,
		streams: tables[0].streams,
	};
};

export const parsePmt = (iterator: BufferIterator): TransportStreamPMTBox => {
	iterator.startReadingBits();

	const tableId = iterator.getBits(8);
	iterator.getBits(1); // syntax indicator
	iterator.getBits(1); // private bit
	iterator.getBits(4);
	const sectionLength = iterator.getBits(10);
	if (sectionLength > 1021) {
		throw new Error('Invalid section length');
	}

	iterator.stopReadingBits();

	const tables = parsePmtTable({iterator, tableId, sectionLength});
	discardRestOfPacket(iterator);
	return tables;
};

View on GitHub (pinned to 78fe4bb3fd)

Solutions

  1. Re-mux the file: ffmpeg -i in.ts -c copy out.ts.
  2. Verify with dvbsnoop or tsreader that the PMT section_length is within bounds.
  3. Re-acquire the source if it is a damaged capture.
  4. Transcode to a simpler container if the PMT descriptors are unusually large.
Defensive patterns

Strategy: validation

Validate before calling

function isValidTs(src: string): boolean {
  try { execSync(`ffprobe -v error -i "${src}" -t 1 -f null -`, {stdio: 'ignore'}); return true; } catch { return false; }
}

Try / catch

try { await parseMedia({src}); }
catch (e) { if (e instanceof Error && e.message === 'Invalid section length') { /* re-mux or reject */ } else throw e; }

Prevention

When it happens

Trigger: parsePmt reads the same bit layout as parsePat (1+1+1+4+10) and throws when sectionLength > 1021. Triggered by a corrupt PMT section header, a misrouted section, or a heavily multiplexed stream whose PMT payload is genuinely too large.

Common situations: Corrupted captures; faulty encoders; multi-program transport streams with large PMT descriptors; bit-flips in the length field.

Related errors


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