Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions quest/m1/mp4-chapters-apple.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# [XS] Apple's players list a finished MP4's chapters

## Goal

A regular MP4 from `container::mp4` with chapters lists them in QuickTime Player
and Safari, read with AVFoundation (`AVAsset.chapterMetadataGroups(bestMatchingPreferredLanguages:)`)
rather than assumed. The chapter text track writes a `tx3g` sample entry because
mp4-atom cannot encode QuickTime's `text` entry; if Apple's reader ignores it,
carry `text` upstream in mp4-atom or find what Apple accepts.

## Plan

ffprobe lists the chapters from either form alone, which a Linux host proves.
Only a Mac reads them the way Apple's players do: write a finished file with
chapters, load it with AVFoundation, and compare titles and start times with
what `chpl` holds.

## Hosts

- macos - AVFoundation and QuickTime Player are the reader under test
26 changes: 0 additions & 26 deletions quest/m1/mp4-chapters.md

This file was deleted.

2 changes: 1 addition & 1 deletion rs/moq-cli/src/repair.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ impl Mp4 {
})?;
let repaired = tokio::task::spawn_blocking(move || {
let mut file = file;
let Some(finish) = moq_mux::container::mp4::repair(&mut file)? else {
let Some(finish) = moq_mux::container::mp4::repair(&mut file, &[])? else {
return anyhow::Ok(false);
};
finish.write(&mut file)?;
Expand Down
2 changes: 1 addition & 1 deletion rs/moq-cli/src/subscribe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ impl Subscribe {
}
};

match mp4.finish()? {
match mp4.finish(&[])? {
Some(trailer) => {
// Converting drops the error of a write still in flight, which flushing returns.
file.flush().await?;
Expand Down
1 change: 1 addition & 0 deletions rs/moq-mux/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- `sync::Consumer::poll_changed` (and `changed` with the `async` feature) waits until the playout schedule differs from a `sync::Schedule` read earlier with `Consumer::schedule`, and returns the new one. It resolves on a re-pinned reference, a moved delay, a lost anchor, or a producer reset onto a clock that schedules differently, and stays parked through anything that moves no due time. A presenter asleep on a picture's due time can wake and re-schedule instead of polling. `Schedule::due` and `Schedule::delay` read the snapshot it waits on.
- MP4 and Matroska import fill a video rendition's `projection` and `stereo` from Spherical Video V2's `sv3d`/`st3d` boxes and Matroska's `Projection`/`StereoMode`, and Opus channel mapping family 2 (raw Opus, Matroska, and other OpusHead sources) imports with `layout: "ambisonic"`. What the catalog cannot describe is refused with `fmp4::Error::UnsupportedSpatial`, `mkv::Error::UnsupportedSpatial`, or `opus::Error::UnsupportedChannelCount`: a cubemap or mesh projection, a nonzero pose, uncentred or vertically cropped equirectangular bounds, a stereo packing other than mono, left-right, or top-bottom with the left eye first, and family 2 at zeroth order or with RFC 8486's non-diegetic stereo pair.
- fMP4 carries surround Opus: a `dOps` channel mapping table (family 1, 2, or 255) imports into the OpusHead description, and an exported `dOps` writes the description's table back instead of refusing it with `opus::Error::UnsupportedMappingFamily`. Family 3, whose OpusHead carries a demixing matrix rather than a table, is still refused both ways.
- `container::mp4::Chapter` and a `chapters` argument to `container::mp4::Export::finish` and `container::mp4::repair` write chapters into a finished MP4, both as Nero's `chpl` box and as a QuickTime chapter text track that the first track references. A chapter is a `Timestamp` on the recorded broadcast's timeline and a title; one before the first sample or after the last is dropped, and more than 255 chapters or a title over 255 bytes is refused with `fmp4::Error::TooManyChapters` or `fmp4::Error::ChapterTitleTooLong`. Pass `&[]` for none.
- `container::mp4::Export::stop` ends a recording before the broadcast does: `next` still returns the fragment each track was buffering, then `None`, so `finish` indexes it.
- `container::fmp4::Muxer::picture_size` reads the picture size a group's keyframe declares in band, so a fetch-on-demand consumer can tell which side of an in-band resize a group falls on.
- `container::Producer::fail` finishes a track with an error instead of aborting it: every group written stays readable, and a reader reaching the end gets the error instead of the end of stream.
Expand Down
8 changes: 8 additions & 0 deletions rs/moq-mux/src/container/fmp4/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,14 @@ pub enum Error {
reason: &'static str,
},

/// A regular MP4's chapter list holds 255 chapters.
#[error("{0} chapters, more than the 255 a chapter list holds")]
TooManyChapters(usize),

/// A regular MP4's chapter list holds titles of 255 bytes.
#[error("a chapter title of {0} bytes, more than the 255 a chapter list holds")]
ChapterTitleTooLong(usize),

/// A file to repair is not a recording that an MP4 export left unfinished.
#[error("not an unfinished mp4 recording: {0}")]
Unrepairable(&'static str),
Expand Down
Loading