remotion-dev/remotion · error · Error

#EXT-X-MEDIA-SEQUENCE directive must have a value

Error message

#EXT-X-MEDIA-SEQUENCE directive must have a value

What it means

Thrown by parseM3uDirective() at parse-directive.ts:81 when a line matches #EXT-X-MEDIA-SEQUENCE but has no numeric value. This directive indicates the sequence number of the first URI in the playlist and is REQUIRED when it is present (RFC 8216 section 4.3.3.2). The parser converts the value via Number().

Source

Thrown at packages/media-parser/src/containers/m3u/parse-directive.ts:81

		return {
			type: 'm3u-endlist',
		};
	}

	if (directive === '#EXT-X-PLAYLIST-TYPE') {
		if (!value) {
			throw new Error('#EXT-X-PLAYLIST-TYPE. directive must have a value');
		}

		return {
			type: 'm3u-playlist-type',
			playlistType: value,
		};
	}

	if (directive === '#EXT-X-MEDIA-SEQUENCE') {
		if (!value) {
			throw new Error('#EXT-X-MEDIA-SEQUENCE directive must have a value');
		}

		return {
			type: 'm3u-media-sequence',
			value: Number(value),
		};
	}

	if (directive === '#EXT-X-DISCONTINUITY-SEQUENCE') {
		if (!value) {
			throw new Error(
				'#EXT-X-DISCONTINUITY-SEQUENCE directive must have a value',
			);
		}

		return {
			type: 'm3u-discontinuity-sequence',
			value: Number(value),

View on GitHub (pinned to 78fe4bb3fd)

Solutions

  1. Ensure the directive carries a non-negative integer: #EXT-X-MEDIA-SEQUENCE:0
  2. Regenerate the playlist with a compliant HLS packager
  3. Verify the playlist response was not truncated

Example fix

// before
#EXT-X-MEDIA-SEQUENCE

// after
#EXT-X-MEDIA-SEQUENCE:0
Defensive patterns

Strategy: validation

Validate before calling

// Pre-fetch and check EXT-X-MEDIA-SEQUENCE has a numeric value
const text = await (await fetch(url)).text();
for (const line of text.split('\n')) {
  const trimmed = line.trim();
  if (trimmed.startsWith('#EXT-X-MEDIA-SEQUENCE')) {
    const colonIdx = trimmed.indexOf(':');
    const val = colonIdx === -1 ? '' : trimmed.slice(colonIdx + 1).trim();
    if (!val || isNaN(Number(val))) {
      throw new Error('#EXT-X-MEDIA-SEQUENCE is missing its numeric value');
    }
  }
}

Try / catch

try {
  await parseMedia({src: url});
} catch (e) {
  if (e instanceof Error && e.message.includes('EXT-X-MEDIA-SEQUENCE')) {
    // fix the playlist source
  }
  throw e;
}

Prevention

When it happens

Trigger: A playlist line '#EXT-X-MEDIA-SEQUENCE' with no colon, or '#EXT-X-MEDIA-SEQUENCE:' with an empty or non-numeric value.

Common situations: Hand-edited or corrupted playlist where the sequence number was removed; encoder bug; playlist truncated after the directive name.

Related errors


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