MNAVChapters
Read chapter metadata of AVAssets
Install / Use
/learn @michaelnisi/MNAVChaptersREADME
MNAVChapters - read chapter marks
The MNAVChapters iOS library reads chapter metadata of audiovisual assets. It reads chapters from MPEG-4 and specifically MP3 files.
Although the id3v2 standard specifies the chapter frame since 2005, I couldn't find a C or Objective-C library that parses this frame correctly. So, inspired by a post over on the auphonic blog, I started this modest Objective-C implementation.
MNAVChapter
A chapter within a media file.
Accessing Chapter Information
title
The title of the chapter.
(nonatomic, copy) NSString *title;
url
An URL string of the chapter.
(nonatomic, copy) NSString *url;
time
The start time of the chapter.
(nonatomic) CMTime time;
duration
The duration of the chapter.
(nonatomic) CMTime duration;
artwork
An embedded chapter image.
(nonatomic) UIImage *artwork;
MNAVChapterReader
The parser which reads chapter marks from timed audiovisual media. It attempts to read chapter information from assets with "org.mp4ra" or "org.id3" meta data formats.
Reading Chapters from an Asset
+ chaptersFromAsset:
Make sense of an AVAsset object and, if possible, return an array of chapters.
+ (NSArray *)chaptersFromAsset:(AVAsset *)asset;
Here is an example of reading chapter marks from one the auphonic demo files:
AVAsset *asset = [self assetWithResource:@"auphonic_chapters_demo" ofType:@"mp3"];
NSArray *chapters = [[MNAVChapterReader chaptersFromAsset:asset];
Install
Add the MNAVChapters Xcode project to your workspace or, to create a release build and use the object files in the build directory, do:
$ make
Run tests from the command-line:
$ make test
Example
This repo contains an Xcode workspace to provide an easy to use example, written in Swift. When you are running the app for the first time, and tap on one of the episodes, be patient. It will have to download the media files, which, depending on your network might take some time. Once received, the files are copied to "/Library/Caches/", and onwardly read from there.
License
Related Skills
node-connect
349.2kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
109.5kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
349.2kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
349.2kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
