TransOgg: Difference between revisions
mNo edit summary |
No edit summary |
||
Line 54: | Line 54: | ||
* the core transOgg container seeks to avoid optional structures, switches, code paths, and features in its framing mechanisms. Optional structures and features are acceptable (and necessary) within metadata. | * the core transOgg container seeks to avoid optional structures, switches, code paths, and features in its framing mechanisms. Optional structures and features are acceptable (and necessary) within metadata. | ||
= High level design = | |||
The high level transOgg design consists of a transport, metadata, and | |||
specified practices. These pieces are conceptually seperable, but the | |||
container cannot succeed missing any one. | |||
== Transport == | |||
Transport is the mechanism of encapsulating and delivering data. | |||
transOgg uses a modified/updated Ogg page mechanism for data and | |||
metadata delivery. | |||
Transport benefits from a simple, fixed encoding. Optional features, | |||
arbitrary extensibility, recursive or non-flat heirarchy, and | |||
conditional semantic encoding are undesirable complications in a low | |||
level transport and should be used only when clearly advantageous or | |||
unavoidable. Specifying transport as a self-contained layer also | |||
seperates correct transport behavior and corner cases from the rest of | |||
the container behavior. | |||
Raw A/V media is fundamentally time-linear in atomic form. Networks | |||
and storage media deliver data for consumption in a time-linear stream | |||
of bytes. Both suggest that a linear encoding is optimal for the | |||
low-level encapsulation. Metadata can build non-linear presentation | |||
from linear segments. Nonlinear structural metadata appears at the | |||
beginning and end of the stream; as such, this metadata can also be | |||
placed in the linear transport easily as the beginning and end of | |||
data. Encapsulating metadata in the transport like the streaming data | |||
also makes it trivial to support streamed metadata and 'rolling | |||
headers' using preexisting transport mechanisms. (*-- discuss both | |||
chaining and multi-segment; metadata that can reach across segments? | |||
etc?) | |||
== Metadata == | |||
Metadata is everything in a stream/file that is not the media stream | |||
itself. transOgg proposes use of Matroska-style metadata in an EBML | |||
encoding. | |||
Metadata encompasses a number of semantically quite different | |||
concepts, eg: | |||
* 1: data about how the individual streams are encoded and encapsulated (codec id, timebase, continuous/discontinuous encoding, codec private data, etc). This metadata is essential to base container operation and must function as container knowledge. It is always located in a fixed position at the beginning of the file as it must be read to bootstrap container operation. | |||
* 2: data about navigating the file as it's currently arranged (linkages, indexing, chapters). This data is either essential to high-level container operation or essential to the application depending on how the implementation abstractions work out. | |||
* 3: data about how the streams are presented for playback (langauge, primary angle, available soundtrack languages, menus). This data is needed by the application. | |||
* 4: user-supplied comments, one-shot auxiliary data (tags, album art). This data is needed by the application and the user. | |||
Each kind of metadata shares some basic traits. It is heirarchical, | |||
largely conditional, and benefits from a rich stable of optional | |||
elements to be used as appropraite. It is also likely that aside from | |||
the MUST elements required for playback (mostly from list 1), not all | |||
metadata will be interesting to all players. An obvious use case is a | |||
memory and CPU constrained mobile device with no bitmapped display | |||
which would want to entirely ignore/skip large album art chunks. | |||
== Specified practices == | |||
Specified practices provide the instruction manual for proper use of | |||
the container system in all cases where the container structure allows | |||
multiple behavioral or encoding possibilities. 'best practices' is a | |||
more common term, however 'best' connotes that such guidelines are | |||
merely suggestive. Specified practices are effectively MUST clauses | |||
that govern proper behavior rather than valid data. | |||
Specified practices are an especially weak point of current FOSS | |||
container offerings. Developers of open projects often value a system | |||
that offers many equivalent ways of performing a task, and leave it to | |||
higher-level developers (or worse, the user) to somehow make an | |||
informed decision of how to proceed. In the container space, this is | |||
undesirable bordering on disaster; 'more' is 'less'. | |||
To choose an absurd example, it might be technologically nifty to be | |||
able to place an index into the middle of a file, but what could it | |||
possibly accomplish? Absurd flexibility results in absurd bugs. When | |||
absurd or clearly suboptimal choices are structurally possible, the | |||
spec should not be silent on the subject. The spec MUST explicitly | |||
address allowed and disallowed behavior to the most complete degree | |||
achievable. |
Revision as of 02:46, 27 May 2010
Due to limitations of wiki-syntax, it should be noted that this page cannot be correctly titled 'transOgg'. The 't' is lowercase.
What is transOgg?
TransOgg is an updated Ogg container (think of it as Ogg 2.0) that makes some changes to the Ogg transport layer and more directly tackles metadata. transOgg: Changes from Ogg summarizes the major changes from the original Ogg container design. This page presents a long-winded, standalone overview of transOgg design points and rationale.
Design Points
In no particular order:
- transOgg is degined for local storage and packet-based transport. It is arranged to minimize round-trips ('seeks' or 'random access') for potentially ultra-high latency systems like HTTP streaming, as well as avoid any structural requirement to burst large amounts of data in a constrained-rate stream. Some intended uses include:
- HTTP push/pull streaming (eg, HTML5, icecast/shoutcast).
- local file storage (eg, digital video storage and online distribution)
- physical media (eg, digital video distribution on optical media)
- packet broadcast (eg, UDP multicast, encrypted multicast)
- transOgg is designed for variable, unpredictably sized data payloads with no minumum or maximum size.
- The transOgg container is structurally designed for streaming (both live and progressive download). It is not possible to construct a valid transOgg stream that is unsuitable for streaming.
- transOgg defines two steam types: continuous-time and discontinuous-time. Continuous-time streams are gapless media such as video and audio. Discontinuous-time streams are media types with unpredictably or irregularly placed data, such as subtitles and timed metadata. (expand on continuous types and how to 'suspend' the stream using null pages/null packets and duration fields)
- transOgg metadata is structurally encapsulated into the transport stream but located at fixed, predictable positions (excepting streamed metadata, which are treated as a discontinuous stream).
- transOgg retains Ogg's non-heirarchical page structure. The new page structure is a blend of Ogg pages, Matroska clusters/blocks and NUT packets. Achievable minimum overhead drops to under .04%; practical overhead improves upon NUT, Ogg and Matroska.
- A transOgg stream always captures and begins demux within 128kB maximum. Fine-grained capture is necessary for efficient streaming, seeking and scrubbing. The overhead tradeoff of a frequent capture pattern is negligable and fully offset by other improvements.
- Multiplexing of multiple elementary streams is performed by interleaving at the page level. The multiplexing algorithm is fully specified, deterministic and delivers optimal buffering behavior. There is no educated guessing or multiple possible practices.
- transOgg buffering is simple and explicitly specified.
- transOgg implements nonlinear features such as menus, chapters, loop points, and branch points out of its linear stream transport by borrowing as completely as possible from CMML, Skeleton and Matroska's EBML metadata specification.
- Valid transOgg streams may be concatenated to form a new, valid transOgg stream. Mandatory reverse linkage at the end of each stream eliminates the need for interpolated bisection search when opening concatenated streams. Cross-link metadata provides file-global indexing and chaptering for chained streams.
- transOgg metadata begins and ends every stream. It is mandatory, fully specified, and part of 'container knowledge'.
- A transOgg stream must begin with the master metadata header. This master header is the first page[s] of the physical transOgg bitstream as well as the logical master metadata stream.
- The metadata stream is a discontinuous stream that may provide additional timed metadata and events throughout the stream, similar to NUT 'info packets'.
- A transOgg stream must end with metadata footer page[s] that provide reverse linkage to the beginning of the stream.
- Tags (user contributed metadata) and Cues (the index) may appear at the head of the stream or in the footer, as may any other metadata elements that could not be known before stream end in a live stream (eg, duration). Single-pass creation tools write these elements in the footer metadata. Tools can later move these elements to the header metadata. All other metadata elements may appear only in the header.
- Headerless capture, multicast, and stateless unicast MAY be supported within the metadata stream using "rolling headers",similar to the "rolling intra" mechanism proposed for the Theora videocodec. This allows stream capture and playback in a bounded timeperiod without OOB transmission of headers or bitrate spikes. It also facilitates file recovery in the event the stream headers are lost.
- Structural codec metadata, such as timebase, keyframing, coding delay, page duration, etc, are replicated in the transOgg container. Unlike Ogg (and to a lesser degree Matroska), no knowledge must be queried or assumed based on the specific codecs in use inorder to mux, demux, remux, repaginate, or seek in a bitstream.
- As in NUT, all streams have their own rational timebase. The encoding used is a parameterized generalization of Ogggranule positions. The granule timebase and parameters are fully specified and declared in the container. The granule mechanism is capable of exact sample positioning without approximation, expressing PTS and DTS of out-of-order encodings, preroll/delay of keyframe-lesscodecs, and distance from last syncpoint.
- All encapsulated packets are stamped with full DTS, PTS, duration, delay, and syncpoint distance.
- Whenever possible, the transOgg specification presents a single, correct, optimal MUST behavior. Whenever possible, the container design seeks to make MUST behaviors structural. We avoid handwaving essential behaviors into 'best practices' documents 'to be specified later'.
- the core transOgg container seeks to avoid optional structures, switches, code paths, and features in its framing mechanisms. Optional structures and features are acceptable (and necessary) within metadata.
High level design
The high level transOgg design consists of a transport, metadata, and specified practices. These pieces are conceptually seperable, but the container cannot succeed missing any one.
Transport
Transport is the mechanism of encapsulating and delivering data. transOgg uses a modified/updated Ogg page mechanism for data and metadata delivery.
Transport benefits from a simple, fixed encoding. Optional features, arbitrary extensibility, recursive or non-flat heirarchy, and conditional semantic encoding are undesirable complications in a low level transport and should be used only when clearly advantageous or unavoidable. Specifying transport as a self-contained layer also seperates correct transport behavior and corner cases from the rest of the container behavior.
Raw A/V media is fundamentally time-linear in atomic form. Networks and storage media deliver data for consumption in a time-linear stream of bytes. Both suggest that a linear encoding is optimal for the low-level encapsulation. Metadata can build non-linear presentation from linear segments. Nonlinear structural metadata appears at the beginning and end of the stream; as such, this metadata can also be placed in the linear transport easily as the beginning and end of data. Encapsulating metadata in the transport like the streaming data also makes it trivial to support streamed metadata and 'rolling headers' using preexisting transport mechanisms. (*-- discuss both chaining and multi-segment; metadata that can reach across segments? etc?)
Metadata
Metadata is everything in a stream/file that is not the media stream itself. transOgg proposes use of Matroska-style metadata in an EBML encoding.
Metadata encompasses a number of semantically quite different concepts, eg:
- 1: data about how the individual streams are encoded and encapsulated (codec id, timebase, continuous/discontinuous encoding, codec private data, etc). This metadata is essential to base container operation and must function as container knowledge. It is always located in a fixed position at the beginning of the file as it must be read to bootstrap container operation.
- 2: data about navigating the file as it's currently arranged (linkages, indexing, chapters). This data is either essential to high-level container operation or essential to the application depending on how the implementation abstractions work out.
- 3: data about how the streams are presented for playback (langauge, primary angle, available soundtrack languages, menus). This data is needed by the application.
- 4: user-supplied comments, one-shot auxiliary data (tags, album art). This data is needed by the application and the user.
Each kind of metadata shares some basic traits. It is heirarchical, largely conditional, and benefits from a rich stable of optional elements to be used as appropraite. It is also likely that aside from the MUST elements required for playback (mostly from list 1), not all metadata will be interesting to all players. An obvious use case is a memory and CPU constrained mobile device with no bitmapped display which would want to entirely ignore/skip large album art chunks.
Specified practices
Specified practices provide the instruction manual for proper use of the container system in all cases where the container structure allows multiple behavioral or encoding possibilities. 'best practices' is a more common term, however 'best' connotes that such guidelines are merely suggestive. Specified practices are effectively MUST clauses that govern proper behavior rather than valid data.
Specified practices are an especially weak point of current FOSS container offerings. Developers of open projects often value a system that offers many equivalent ways of performing a task, and leave it to higher-level developers (or worse, the user) to somehow make an informed decision of how to proceed. In the container space, this is undesirable bordering on disaster; 'more' is 'less'.
To choose an absurd example, it might be technologically nifty to be able to place an index into the middle of a file, but what could it possibly accomplish? Absurd flexibility results in absurd bugs. When absurd or clearly suboptimal choices are structurally possible, the spec should not be silent on the subject. The spec MUST explicitly address allowed and disallowed behavior to the most complete degree achievable.