remotion-dev/remotion · error · Error

EXT-X-MEDIA directive must have a value

Error message

EXT-X-MEDIA directive must have a value

What it means

Thrown by parseM3uDirective() at parse-directive.ts:32 when a line matches #EXT-X-MEDIA but has no attribute value after the colon. The #EXT-X-MEDIA directive declares audio, subtitle, or closed-caption renditions and requires attributes (TYPE, GROUP-ID, NAME, etc.) to describe the rendition. The parser delegates to parseM3uMediaDirective which needs a non-null value string.

Source

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

		if (!value) {
			throw new Error('EXT-X-VERSION directive must have a value');
		}

		return {
			type: 'm3u-version',
			version: value,
		};
	}

	if (directive === '#EXT-X-INDEPENDENT-SEGMENTS') {
		return {
			type: 'm3u-independent-segments',
		};
	}

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

		const parsed = parseM3uMediaDirective(value);

		return parsed;
	}

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

		return {
			type: 'm3u-target-duration',
			duration: parseFloat(value),
		};
	}

View on GitHub (pinned to 78fe4bb3fd)

Solutions

  1. Ensure #EXT-X-MEDIA carries full attributes, e.g. #EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="aac",NAME="English",DEFAULT=YES,AUTOSELECT=YES,LANGUAGE="en",URI="audio.m3u8"
  2. Regenerate the playlist with a compliant packager
  3. Remove the malformed EXT-X-MEDIA line if the rendition is not needed

Example fix

// before
#EXT-X-MEDIA:

// after
#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="aac",NAME="English",DEFAULT=YES,AUTOSELECT=YES,LANGUAGE="en",URI="audio_en.m3u8"
Defensive patterns

Strategy: validation

Validate before calling

// Pre-fetch and check EXT-X-MEDIA lines have attributes
const text = await (await fetch(url)).text();
for (const line of text.split('\n')) {
  const trimmed = line.trim();
  if (trimmed.startsWith('#EXT-X-MEDIA')) {
    const colonIdx = trimmed.indexOf(':');
    if (colonIdx === -1 || !trimmed.slice(colonIdx + 1).trim()) {
      throw new Error('#EXT-X-MEDIA is missing its attributes');
    }
  }
}

Try / catch

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

Prevention

When it happens

Trigger: A playlist line '#EXT-X-MEDIA' with no colon or '#EXT-X-MEDIA:' with empty attributes — no TYPE=, GROUP-ID=, NAME= key-value pairs.

Common situations: Corrupted audio or subtitle track declaration in a master playlist; encoder bug producing incomplete EXT-X-MEDIA lines; hand-edited playlist where attributes were removed.

Related errors


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