remotion-dev/remotion · error · Error

EXT-X-TARGETDURATION directive must have a value

Error message

EXT-X-TARGETDURATION directive must have a value

What it means

Thrown by parseM3uDirective() at parse-directive.ts:42 when a line matches #EXT-X-TARGETDURATION but has no numeric value. This directive is REQUIRED in every media playlist per RFC 8216 and specifies the maximum media-segment duration in seconds. The parser passes the value through parseFloat(), so it must be present.

Source

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

	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),
		};
	}

	if (directive === '#EXTINF') {
		if (!value) {
			throw new Error('EXTINF has no value');
		}

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

View on GitHub (pinned to 78fe4bb3fd)

Solutions

  1. Ensure the directive has a numeric value: #EXT-X-TARGETDURATION:10
  2. Regenerate the playlist with a compliant HLS packager
  3. Verify the media playlist was fully received (no truncation)

Example fix

// before
#EXT-X-TARGETDURATION

// after
#EXT-X-TARGETDURATION:10
Defensive patterns

Strategy: validation

Validate before calling

// Pre-fetch and check EXT-X-TARGETDURATION 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-TARGETDURATION')) {
    const colonIdx = trimmed.indexOf(':');
    const val = colonIdx === -1 ? '' : trimmed.slice(colonIdx + 1).trim();
    if (!val || isNaN(Number(val))) {
      throw new Error('#EXT-X-TARGETDURATION is missing its numeric value');
    }
  }
}

Try / catch

try {
  await parseMedia({src: url});
} catch (e) {
  if (e instanceof Error && e.message.includes('EXT-X-TARGETDURATION')) {
    // fix the playlist or regenerate with a compliant packager
  }
  throw e;
}

Prevention

When it happens

Trigger: A playlist line '#EXT-X-TARGETDURATION' with no colon, or '#EXT-X-TARGETDURATION:' with no number after it.

Common situations: Corrupted or hand-edited media playlist missing the required duration value; encoder bug omitting the value; playlist truncated after the directive name.

Related errors


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