Skip to content

HEVC-in-MPEG-TS HLS VOD direct media playlist routes to AVPlayer with 0x0 video #268

Closed

Description

@qoli

What happened?

A seekable remote HLS VOD whose direct media playlist contains HEVC video in MPEG-TS segments is routed to the native AVPlayer backend. AVPlayer accepts the item, exposes an AAC audio path and advances its clock, but AetherEngine reports no video dimensions and no video is presented.

This is the VOD/direct-media counterpart of #168, not a live-stream case:

  • the playlist is a media playlist, not a master playlist;
  • it contains #EXT-X-ENDLIST;
  • its segments are MPEG-TS (.ts, no #EXT-X-MAP);
  • the first actual segment probes as HEVC Main, 3840x2160, 25 fps, plus AAC;
  • the source has a finite duration and must retain ordinary VOD seek semantics.

With nativeRemoteHLS = false, AetherEngine's normal source decision still ends at the native backend:

aether_backend=native
aether_current_avplayer=present
duration_seconds=2698.760
video_width=0
video_height=0
phase=paused
error_code=aether_video_required
message="AetherEngine baseline requires video, but the source dimensions are 0x0"

The same source through the Hybrid AVKit surface confirms the misleading healthy-looking state:

route=nativeAVPlayer
startup: currentTime 0 -> 2 s
seek: 2 -> 90 s, landing error 0
post-seek: currentTime 90 -> 92 s

The clock and seek advance, but the presented video remains black. This matches the carriage failure described in #168: AVPlayer does not build the HEVC video track from MPEG-TS HLS carriage.

Why the existing fixes do not cover it

#168 shipped a TS -> fMP4 ingest reroute, but the current gate is live-only and depends on master-playlist variant evidence:

static func shouldArm(isLive: Bool, fallbackEnabled: Bool) -> Bool {
    isLive && fallbackEnabled
}

A direct media playlist has no AVAsset.variants advertisement, and this source has isLive == false, so that watchdog cannot arm.

#246 / 5.29.0 fixes second-open typed HLS detection and preserves the VOD resume anchor, but its destination remains the native remote-HLS bypass. That makes HLS admission reliable; it does not detect unsupported HEVC-in-MPEG-TS carriage before selecting AVPlayer.

The same live-only gate and VOD-native routing are still present in 6.3.0.

Steps to reproduce

  1. Serve a finite HLS media playlist with #EXT-X-ENDLIST.
  2. Use MPEG-TS segments containing HEVC video and AAC audio.
  3. Call:
let options = LoadOptions(
    httpHeaders: requiredHeaders,
    isLive: false,
    nativeRemoteHLS: false,
    autoplay: false
)

try await engine.load(
    url: mediaPlaylistURL,
    startPosition: nil,
    options: options
)
  1. Observe that AetherEngine returns the native backend with currentAVPlayer != nil, duration is populated, but video dimensions remain 0x0.
  2. Starting playback advances media time and audio; seeking lands, but video remains black.

The private signed URL and credential-bearing headers are intentionally omitted. The playlist and first segment were fetched successfully immediately before the device run.

Expected behavior

Once AetherEngine has content-backed evidence that a seekable HLS VOD carries HEVC in MPEG-TS, it should not hand that source directly to AVPlayer.

It should route the same URL and headers through a seekable VOD remux path that converts TS carriage to AVPlayer-compatible fMP4 while preserving:

  • finite duration;
  • startPosition;
  • random forward/backward seek;
  • source URL and HTTP headers;
  • a single bounded load decision.

This must not use live semantics or HLSLiveIngestReader: treating the source as live would break the VOD seek contract.

Suggested acceptance criteria

  • Direct media playlists are supported; the decision does not require AVAsset.variants.
  • HLS evidence comes from playlist/segment content, not the .m3u8 suffix alone.
  • HEVC-in-MPEG-TS VOD selects a seekable TS -> fMP4 remux route.
  • URL, headers and startPosition are preserved.
  • Forward and backward seeks land and continue advancing.
  • H.264/AAC HLS VOD that AVPlayer supports can remain on the native path.
  • Audio-only playlists are not mistaken for failed video.
  • No retry through another source, provider or player.
  • Tests cover both a direct media playlist and a master playlist carrying the same HEVC-in-TS VOD.

AetherEngine version or commit SHA

5.26.0 / 051fff80b5f4bd26981207b7a77426d4010792cb

Also inspected through the 6.3.0 release source; the relevant ingest fallback remains live-only.

Host app

SyncnextHybrid diagnostic smoke player

Platform

tvOS physical Apple TV

Playback path

Native AVPlayer selected by AetherEngine's normal routing decision

Related issues

Activity

  1. added a commit that references this issue on Jul 31, 2026
  2. superuser404notfound commented on Jul 31, 2026

    @superuser404notfound
    Owner

    Reopening until this is confirmed on hardware. The fix is on main, but nothing here has met a real device yet, and the source that reported it cannot be shared, so the local verification runs against generated fixtures.

  3. superuser404notfound commented on Jul 31, 2026

    @superuser404notfound
    Owner

    Released in 6.4.0, together with the follow-up hardening described above.

    For the retest against the original source, three log lines say the route was taken and how it behaved:

    [AetherEngine] AE#268: finite HEVC-in-MPEG-TS HLS; routing through the seekable TS -> fMP4 ingest
    [HLSVODIngest] resolved finite MPEG-TS VOD segments=<N> duration=<seconds>s
    [HLSVODIngest] seek elapsed=<seconds>s segment=<index> segmentStart=<seconds>s
    

    The third one is the interesting one on a seek: elapsed is the target on the playlist axis after the container's PTS origin has been taken off, and segment is the one the ingest restarts at, which is deliberately the segment ahead of the target. If a seek on hardware lands somewhere other than where it was asked to, that line plus the producer restarted at idx=... line next to it will say which of the two axes is off.

    Worth knowing for the retest: 6.4.0 also changes what currentTime reports for a source whose container PTS does not start at zero. It is now 0-based like duration, where it previously carried the origin (#270). If the diagnostic host compares positions against stored values from an earlier build, that is where a constant offset would come from.

  4. qoli commented on Aug 1, 2026

    @qoli
    ContributorAuthor

    Hardware retest against the original private source is complete on a physical Apple TV using AetherEngine 6.4.0 through the SyncnextHybrid smoke host.

    The source is a finite 3840x2160 HEVC-in-MPEG-TS HLS VOD with AAC audio. Its signed URL and credential-bearing headers remain omitted.

    Route and playlist resolution

    Both runs selected the intended path and resolved the same finite playlist:

    [AetherEngine] AE#268: finite HEVC-in-MPEG-TS HLS; routing through the seekable TS -> fMP4 ingest
    [HLSVODIngest] resolved finite MPEG-TS VOD segments=270 duration=2698.76s
    

    Startup playback advanced normally and exposed a 3840x2160 video track.

    Control seek: 122.000 s — pass

    [HLSVODIngest] seek elapsed=120.00s segment=11 segmentStart=110.00s
    [HLSVideoEngine] producer restarted at idx=30 (seek=121.48s [absolute source-PTS], restart took 12ms; stopWait=7ms seek=4ms build=0ms)
    

    The rendered display timeline stabilized at 122.000 s, advanced by 2.003 s, and continued playing for 12.004 s after the seek. The strict run passed.

    Long seek: 1055.790757 s — reproducible failure

    [HLSVODIngest] seek elapsed=1052.00s segment=104 segmentStart=1040.00s
    [HLSVideoEngine] producer restarted at idx=263 (seek=1053.48s [absolute source-PTS], restart took 12ms; stopWait=6ms seek=5ms build=0ms)
    

    The ingest/producer pair above was repeated unchanged during recovery attempts, always using segment 104 and producer index 263.

    The initial public currentTime reported the requested 1055.791 s, but the rendered/source timeline had not landed: after 15 s the player was still seeking and rendered display time was 1.952 s. At 30 s it moved to 1059.823 s (about 4.032 s after the requested position) and remained rebuffering. It was still rebuffering at 45 s, then failed with:

    CoreMediaErrorDomain error -12889
    

    This long-seek failure was reproduced in two independent hardware runs with the same segment/restart mapping and the same final error.

    So the 6.4.0 content gate, finite-playlist resolution, and a near seek are confirmed on hardware against the original source. The original-source acceptance is not fully green because the longer seek does not recover after the deterministic ingest/producer restart. The evidence appears to place the remaining failure after route selection and playlist segment mapping, but I am leaving the source-PTS/display-axis interpretation open for maintainer analysis.

    No alternate source, provider, or player fallback was used in either run.

  5. qoli commented on Aug 1, 2026

    @qoli
    ContributorAuthor

    Additional source fingerprint for finding or generating a non-private equivalent fixture:

    HLS structure

    direct media playlist (not a master playlist)
    HLS version:              3
    media sequence:           0
    target duration:          10 s
    segments:                 270
    total EXTINF duration:    2698.760 s
    segment durations:        269 x 10.000 s, final segment 8.760 s
    segment container:        individual .ts files (MPEG-TS)
    #EXT-X-ENDLIST:           present
    #EXT-X-PLAYLIST-TYPE:     absent
    #EXT-X-MAP:               absent
    #EXT-X-BYTERANGE:         absent
    #EXT-X-DISCONTINUITY:     absent
    #EXT-X-KEY:               absent (unencrypted)
    

    This is therefore a finite direct-media MPEG-TS VOD, not CMAF/fMP4 HLS and not a live/event window.

    Elementary streams in the TS

    Video:

    codec:                    HEVC / H.265
    profile:                  Main (8-bit, not Main 10)
    PMT stream type:          0x24
    resolution:               3840x2160
    pixel format:             yuv420p
    frame rate:               25/1 fps
    HEVC level reported:      150 (Level 5.0)
    color range:              TV/limited
    stream PID:               0x100
    timestamp time base:      1/90000
    

    Audio:

    codec/profile:            AAC-LC
    PMT stream type/tag:      0x0f
    sample rate:              44100 Hz
    channels:                 2, stereo
    nominal bitrate observed: about 129.5 kb/s
    stream PID:               0x101
    timestamp time base:      1/90000
    

    The first 10 s TS segment was 2,671,856 bytes, approximately 2.14 Mb/s at the container level.

    Timestamp and GOP shape

    The MPEG-TS timestamps are continuous across segments and do not begin at zero:

    container/audio start:    1.456778 s
    first video PTS:          1.480000 s
    segment 0 first video:    key I-frame at PTS 1.480000
    segment 104 first video:  key I-frame at PTS 1041.480000
    

    Each regular 10 s segment contains 250 video frames at 25 fps and begins with its only key I-frame. The first segment contains 249 frames. In other words, segment boundaries and the 10 s GOP are aligned, while the source PTS axis has an approximately 1.46–1.48 s origin.

    A useful search/generation fingerprint is:

    HEVC Main 8-bit 3840x2160p25 + AAC-LC 44.1 kHz stereo, muxed as MPEG-TS HLS VOD with 10-second keyframe-aligned TS segments, continuous 90 kHz timestamps, and a non-zero ~1.46 s PTS origin.

    For reproducing the observed distinction, the fixture should be longer than 1055 s (ideally around 45 minutes). A 122 s seek succeeds on the original, while a 1055.79 s seek repeatedly fails; a short sample would therefore miss the remaining problem even if its codec and carriage match.

    No URL, signed query, request header value, title, or content identifier is included here.

  6. superuser404notfound commented on Aug 1, 2026

    @superuser404notfound
    Owner

    Thank you for the hardware retest, and for the source fingerprint in particular. The GOP shape in it is what the diagnosis turned on.

    The two runs separate on a single number. The control seek restarts the producer at index 30, which starts at 120 s; the long seek restarts at index 263, which starts at 1052 s. The plan behind those indices is a synthetic uniform 4 s grid, while your source carries one I-frame per 10 s segment, so only every fifth plan boundary is a random-access point. 120 is a multiple of both 4 and 10. 1052 is not. The control seek is the one alignment in five that works.

    What happens on the other four:

    • The producer's scan-forward gate takes the first IRAP at-or-after its restart target. For index 263 that target is source PTS 1053.48 and the next I-frame is at 1061.48, so the gate opens 8 s late.
    • That overshoot then rides in the producer's timeline shift, where the video cutter and the audio index mapping fold it back on two different axes. They end up disagreeing by those 8 s.
    • AVPlayer is left waiting on a segment that never arrives at the position it asked for. CoreMediaErrorDomain -12889 is this engine's known signature for exactly that, and it matches the rest of your report: the recovery attempts repeated the same ingest/producer pair unchanged because each one reproduced the same skew.

    Why the ingest route did not prevent it: the playlist is resolved for reading, but it was not used for planning. MPEG-TS has no upfront keyframe table, so the plan fell back to the uniform grid instead of the boundaries your playlist declares.

    The fix is in #275: the segment plan is built on the source's own segment starts, so every advertised boundary is one the gate can open, plus the two axis corrections the misaligned case exposed.

    Reproduced and measured locally on a fixture with your shape (20 min, 10 s segments with one I-frame each, HEVC plus AAC in MPEG-TS, non-zero PTS origin) over a static origin, five scattered seek targets including your 1055.79 s:

    gate overshoot per restart
    before 0 / 4 / 0 / 2 / 6 s
    after 0.5 s on every restart (the plan's own boundary backoff)

    Before, the misaligned restarts also reproduced the stalled consumer and the repeated identical re-anchor at one index. After, the seeks land in 77 to 114 ms with no wedge and no re-anchor.

    Your private source stays out of it, but a run against it is what closes this out: the next release plus the same two seeks, 122 s and 1055.79 s.

  7. added a commit that references this issue on Aug 2, 2026
  8. superuser404notfound commented on Aug 2, 2026

    @superuser404notfound
    Owner

    Released in 6.4.2. Both consumers are bumped, so a Sodalite or AetherPlayer build from main carries it too.

    When you get to it, the same two seeks against your original source are what this needs: 122 s as the control and 1055.79 s as the case that failed. In the log, video gate open is the line that tells the story now, anchorPts - target should stay at half a second on every restart instead of jumping to a multiple of the segment stride.

  9. qoli commented on Aug 6, 2026

    @qoli
    ContributorAuthor

    Retested the 6.4.2 fix (996d8d3b616039f8ce17ebd527df14a9b2cd6a21) on the physical study-room Apple TV through SyncNext + SyncnextHybrid's avKitProxy route, using the original private source.

    Source fingerprint (no signed URL or headers included):

    • finite direct-media HLS VOD with #EXT-X-ENDLIST
    • HEVC Main, 3840x2160, 25 fps + AAC in MPEG-TS
    • approximately 10 seconds per source segment
    • duration: 2698.760 seconds (about 270 source segments)

    Exact requested seeks:

    1. 122.000000 s control

      • source seek: elapsed=119.50s segment=11 segmentStart=110.00s
      • producer restart: idx=12, absolute source-PTS seek 120.98s
      • video gate open: anchorPts=10933200 target=10888200
      • anchorPts - target = 45000 ticks = 0.500 s at 90 kHz
      • SyncNext landed at 122.000 s and advanced another 2.017 s
    2. 1055.790757 s regression case

      • source seek: elapsed=1049.50s segment=104 segmentStart=1040.00s
      • producer restart: idx=105, absolute source-PTS seek 1050.98s
      • video gate open: anchorPts=94633200 target=94588200
      • anchorPts - target = 45000 ticks = 0.500 s at 90 kHz
      • SyncNext landed at 1055.793 s and advanced another 2.038 s

    The integration acceptance finished with status=passed, startup playback also advanced normally, and no alternate source, provider, player, or fallback route was used.

    The separately known backward-restart limitation was intentionally excluded from this acceptance; it predates this fix and is not a regression introduced by 6.4.2.

    This satisfies the requested original-source verification. Thank you for the fix — closing this issue as completed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions