Multiple audio streams, video streams and subtitles are stored in one container. These are played back together.
Where is the synchronization information stored in the container format? In meta-data or somewhere else?
|
Multiple audio streams, video streams and subtitles are stored in one container. These are played back together. Where is the synchronization information stored in the container format? In meta-data or somewhere else? |
||||
|
|
|
It depends on the container itself. Different containers handle synchronization differently. The difference lies in the way the data itself is stored. For example, the container can choose to just store parts that should be presented at the same time together, or insert synchronization points every one in a while, or even give every data chunk a timestamp. Some containers can be time-based, while others are just a stream of data. Of course, the latter has performance advantages, but synchronization can be off, and seeking isn't possible without a specific index (like in AVI). For example, the MPEG-2 Transport Stream, a very early container format, uses packetized elementary streams to store the data. For example, you'll have one packetized stream for video, and one for audio. In order to synchronize them, there is the Program Clock Reference field:
The popular MP4 container is based on the QuickTime File Format and therefore shares a common base of features. Its specification can be found here. Synchronization is not part of metadata, it's part of the actual data itself. I haven't looked into the details though. When using RTP Hint Tracks, an MP4 file can be prepared for streaming, by indicating which packets are correlated to which timestamp in the media. So, for example, a hint track will say: This packet here is made up of this video data and that audio data. Those are ignored for local playback though. AVI containers are based on RIFF. They store the individual data frames in "chunks". As the data itself can be split into individual frames (e.g. video frames, audio frames), this even works with variable bitrate content, as the frame length will always be the same. This document has an explanation of the AVI format in detail. The important aspect of synchronization is that the AVI is correctly multiplexed. The Matroska container is similar to MP4 and others. It is entirely timecode-based, as you can see in this diagram. The data itself (e.g. video, audio) is split into Clusters and then Blocks. The timecode is more-or-less treated like a presentation timestamp.
The Ogg container, which is not that popular, does it as follows:
However, Ogg does not know anything about the codec and a "time" concept:
|
||||
|
|