Skip to content

VOD cold-start pays a mandatory sequential head→tail→re-anchor round trip on non-fast-start MP4 sources — request for parallel fetch or moov-offset hint #281

Description

@digilearn-dev

What happened?

On every fresh VOD load against a non-fast-start MP4 source (moov atom at file end), the demuxer open sequence costs 1.2-2.8s of pure network round-trip time before frame rate / stream metadata is available, via three sequential connections:

gen=1: offset=0, len=32MB → real data connection (~1-2s)
gen=2: offset=, len=0MB → moov atom / tail probe (~130-750ms)
gen=3: offset=, len=32MB → re-anchor (~45-100ms)

This is confirmed consistent across multiple sessions and titles on our end. It's occurring before any codec/DisplayCriteria logic engages, so it's purely the cost of locating and reading the trailing moov atom.

I checked #69 and see this matches the documented non-fast-start MP4 behavior — the detour-block cache fix there collapsed what could otherwise be a reconnect storm down to this legitimate minimum sequence, but the sequential round-trip cost itself remains by design. I'm not reporting a regression from that fix; I'm asking whether there's room to reduce this legitimate minimum further, since for slower/higher-latency sources (debrid-style proxies in our case) this is now the single largest contributor to VOD time-to-first-frame — bigger than anything in the DisplayCriteria path (#274/#277).

Steps to reproduce

  1. Load a VOD title from a non-fast-start remote MP4 source (moov atom at end of file) with meaningful network latency to the host (not a fast local/CDN path).
  2. Observe AVIOReader logs: pump conn start gen=1 offset=0, followed by pump conn start gen=2 offset= len=0MB, followed by pump conn start gen=3 offset=<near 0>.
  3. Measure elapsed time from open_started to the point frame rate/stream info becomes available — the three round trips dominate this window on higher-latency sources.

AetherEngine version or commit SHA

6.4.3

Host app

Custom / my own integration

Platform

tvOS

OS version

tvOS 26.6 (beta)

Device / chip

Apple TV 4K (A15)

Playback path

Native AVPlayer

Source media (for playback bugs)

Various VOD titles served via a remote HTTP source (debrid-style proxy) producing non-fast-start MP4 (moov atom at file end). Not codec/resolution-specific.

Error codes / log lines

[AVIOReader] pump conn start gen=1 offset=0 len=32MB
[AVIOReader] File size: 4502623452 bytes (data connection)
[AVIOReader] pump gen=1 first data after 1011ms
[AVIOReader] pump conn start gen=2 offset=4502622327 len=0MB
[AVIOReader] pump conn gen=1 ended with error: cancelled
[AVIOReader] pump gen=2 first data after 747ms
[AVIOReader] pump conn start gen=3 offset=5756 len=32MB
[AVIOReader] pump gen=3 first data after 103ms

No errors — this is expected, working behavior, just a real latency cost we're asking about.

Anything else

Checked the public LoadOptions surface (6.4.3) exhaustively before filing — confirmed there's no host-facing content-length hint, moov-offset hint, parallel head+tail fetch option, or way to influence this open sequence. probesize/maxAnalyzeDuration (#68) only bound find_stream_info after the demuxer is open; they don't affect the need to seek to a trailing moov. Also checked #70 (redundant size probe removal) and #126 (moov-at-end + unknown length) as related prior work — this report is a step beyond both, not a regression of either.

Possible directions, offered as starting points rather than a specific implementation ask:

Issue the tail probe (gen=2) concurrently with the initial data connection (gen=1) rather than sequentially, since they're logically independent reads.
A host-supplied content-length or last-known-moov-offset hint (keyed by URL) for sources the host already has size/duration metadata for via other means (e.g., from a provider API), letting the engine skip straight to the real read.
A durable moov-offset cache keyed by URL for repeat plays of the same file, if the in-process SourceContentLengthCache (#112) could be extended or paralleled for this purpose — understanding that's currently internal/enum-based and not something we're asking to be made public, just flagging it as prior art that might already be close to reusable internally.

Not a regression, not blocking — flagging as an opportunity, since this is now the largest single contributor to VOD cold-start time on our slower sources, larger than anything in the DisplayCriteria path.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions