Skip to content

DASH: support multi-period MPD merging (concat fragments across periods) #239

@crippledgeek

Description

@crippledgeek

Scope

Make expand_dash_representations emit Formats from ALL <Period> elements in a multi-period MPD (today: first period only + warn). Match yt-dlp's _merge_mpd_periods behavior of concatenating fragments across periods for matching streams.

Why

DASH multi-period manifests are common for ad-insertion ("pre-roll-then-content"), chapter splits, and live-archive recordings stitched into a VoD. yt-dlp _merge_mpd_periods (yt_dlp/extractor/common.py:2708–2733) flattens periods into one logical stream by concatenating fragment lists for matching format_id keys.

PR #235 chose first-period-only as the conservative default. Real-world multi-period MPDs will break (only the first period plays) until this lands.

Acceptance criteria

  • expand_dash_representations walks all periods, not just mpd.periods.first().
  • Per-period Reps with matching (adapt_idx, repr_idx) (or matching repr.id) are merged: the second period's fragments append to the first's Fragment list.
  • Periods with no matching Rep produce a separate Format with a period-suffixed format_id (v720p_period2).
  • Hand-authored fixture MPD with two periods × two Reps each → 2 Formats, each carrying fragments from both periods.
  • The "Multi-period MPDs" design-doc non-goal is updated to reflect support landing.

Out of scope

  • Cross-period codec changes (yt-dlp emits separate Formats; we should too).
  • Period-level discontinuity handling at the muxer level.

Metadata

Metadata

Assignees

No one assigned

    Labels

    dashMPEG-DASH protocolenhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions