edith_codecs
Clone
https://git.tahinli.com/Tahinli/edith_codecs.git
0 watching0 forksRust370.3 MiB9b67700Tahinli3 days ago4021 commits
Lane chapters: report
Base: main at 00054596. Branch lane/chapters.
Goal
Exports carry chapters given as (start_ns: u64, title: String). Two halves: the mp4 writer in
ec-mp4 (this repo), and the edith side (lane-chapters in ~/.cache/wt/edith-chapters, commit
07b8c8a), which hands the list to the mp4 and Matroska writers.
Changes in this repo
crates/ec-mp4/src/mux.rsMp4Muxer::set_chapters(&[(u64, String)]) -> Result<()>. Sorts by start (stable). Writes thechplonly for 1 to 255 chapters, since its count is one byte. Past 255 no error is raised: the chapter track carries all of them.moov/udta/chpl(1 to 255 chapters only): version 1, start times in 100 ns units, one-byte title length. Titles are cut to 255 bytes on a character boundary.- QuickTime chapter track: a disabled
texthandler track, onetextsample per chapter, sample bytes in themdat(16-bit length plus UTF-8 title),co64offset,mdhdlanguageund, timescale 1000 (ms). Each chapter runs to the next start; the last runs to the film's end. - Reference:
tref/chapin the first video track, else the first audio track, else track 0. - A chapter that starts after 0 gets an empty
edtsedit, so the track starts at the first chapter. - Unit tests:
chplbyte layout,tref/chaptarget, no chapter boxes when the list is empty, the 255 limit, title clipping on character boundaries.
crates/ec-mp4/tests/chapters.rs(new): ffprobe parity.ffprobe -show_chaptersmust list the same starts (to the ms) and titles as given, including a non-zero first chapter; a file with no chapters lists none; the demuxer still opens a chaptered file and reads all its audio packets.
Verify
Run on host c with scripts/remote-run.sh chapters --host c -- ...:
cargo test --release -p ec-mp4: all pass. Unit 31,chapters4, others as before. 0 failures.cargo clippy -p ec-mp4 --all-targets -- -D warnings: clean.cargo fmt -p ec-mp4 -- --check: my hunks are formatted. The remaining diffs are indemux.rsand an import order inmux.rs's test module, all from before this lane.- Line limit:
mux.rsis 1,468 lines, under 5,000.
Observed ffprobe 8.1.3 output for a three-chapter file: starts 0, 5000, 12345 ms, the titles as
given, and one entry per chapter (the chpl and the chapter track do not double up).
Left
- The peer that owns
project.rsfillsExportSettings::chapters. Nothing in this lane sets it. edithexport.rsis 9,636 lines. That is over the 5,000-line rule, and it was already that long before this lane. Not split here.