Container/MP4/TS/PS/HLS
A media container is a file format or streaming format (a stream, unlike a file, is not a subject of storage), whose specifications determine only the way data is presented (and not an encoding algorithm) within a single file. The media container defines the size and structure of the data to be presented, however, it does not define any codification of the data itself. The media container is actually a meta format, as it stores data and information about how the data will be stored within the file. As a consequence, a program that is able to correctly identify and open a file (read a stream) written in any format may subsequently be unable to decode the actual data recorded inside the media container, since either the metadata in the media container is insufficient, or the software is unable to decode data encoded in the media container.
In theory, the container format is capable of storing any type of data, but in practice, there are separate groups of containers for each data type. These groups are "tuned" for specific requirements and the information that will be stored in them. Media containers are a typical example of such a group of file containers, which are designed to store media information, which is conventionally divided into images, video, and audio. In the case of movies, the media container must not only store the video and audio stream but also the cues to keep them synchronized during playback. Several streams of the same type can be stored in the media container, for example, a movie (video stream) with several audio tracks (audio streams) and subtitles (text streams).
The differences between various container formats arise from five main issues:
- Popularity; how widely supported a container is.
- Overhead. That is the difference in file size between two files with the same content in a different container.
- Support for advanced codec functionality. Older formats such as AVI do not support new codec features like B-frames, VBR audio, or VFR video natively. The format may be "hacked" to add support, but this creates compatibility problems.
- Support for advanced content, such as chapters, subtitles, meta-tags, user data.
- Support of streaming media.
MPEG-4 Part 14 or MP4 is a digital multimedia container format most commonly used to store video and audio, but it can also be used to store other data such as subtitles and still images. Like most modern container formats, it allows streaming over the Internet. The only filename extension for MPEG-4 Part 14 files as defined by the specification is .mp4. MPEG-4 Part 14 (formally ISO/IEC 14496-14:2003) is a standard specified as a part of MPEG-4.
MPEG-4 Part 14 Container supports the following data formats:
- Video streams: MPEG-H Part 2 (H.265 / HEVC), H.264 / MPEG-4 Part 10, MPEG-4 Part 2, H.262 / MPEG-2 Part 2, H.261 / MPEG-1 Part 2 ...
- Audio streams: MPEG-4 Part 3, MPEG-2 Part 7, MPEG-1 Audio Layer III, MPEG-1 Audio Layer II, MPEG-1 Audio Layer I.
- Subtitles: MPEG-4 Part 17.
- Static images: JPEG, PNG.
Currently, the most widely used combination of H.264 / MPEG-4 Part 10 and Advanced Audio Coding, since most players have hardware decoding capabilities for these streams.
MP4 files can contain metadata defined by the standard, such as file creation time, duration, stream language code, album name, title's legal status, etc.
MPEG transport stream (MPEG-TS, MTS) or simply transport stream (TS) is a standard digital container format for transmission and storage of audio, video, and Program and System Information Protocol (PSIP) data.[3] It is used in broadcast systems such as DVB, ATSC, and IPTV.
The transport stream specifies a container format encapsulating packetized elementary streams, with error correction and synchronization pattern features for maintaining transmission integrity when the communication channel carrying the stream is degraded.
Transport streams differ from the similarly-named MPEG program stream in several important ways: program streams are designed for reasonably reliable media, such as discs (like DVDs), while transport streams are designed for less reliable transmission, namely terrestrial or satellite broadcast. Further, a transport stream may carry multiple programs.
The transport stream is specified in MPEG-2 Part 1, Systems, formally known as ISO/IEC standard 13818-1 or ITU-T Rec. H.222.0. Each stream is chopped into (at most) 188-byte sections and interleaved together; because of the tiny packet size, streams can be interleaved with less latency and greater error resilience compared to program streams and other common containers such as AVI, MOV/MP4, and MKV, which generally wrap each frame into one packet. This is particularly important for video conferencing, where large frames may introduce unacceptable audio delay.
Transport streams tend to be broadcast as constant bitrate (CBR) and filled with padding bytes when not enough data exists.
MPEG-2 (PS) (a.k.a. H.222/H.262 as was defined by the ITU) is a standard for "the generic coding of moving pictures and associated audio information". It describes a combination of lossy video compression and lossy audio data compression methods, which permit storage and transmission of movies using currently available storage media and transmission bandwidth. While MPEG-2 is not as efficient as newer standards such as H.264/AVC and H.265/HEVC, backwards compatibility with existing hardware and software means it is still widely used, for example in over-the-air digital television broadcasting and the DVD-Video standard.
HLS (HTTP Live Streaming) is an HTTP-based media streaming communication protocol used by Apple as part of QuickTime, Safari, OS X, and iOS software. The work is based on the principle of splitting a whole stream into small fragments, which are downloaded via HTTP. The stream is continuous and theoretically could be infinite. At the beginning of the session, a playlist is downloaded in M3U format.
The protocols only use standard HTTP transactions, the protocol allows a stream to traverse firewalls or proxy servers that allow HTTP traffic, unlike UDP-based protocols such as RTP. It also allows content to be served via general-purpose HTTP servers as a source, as well as delivered to consumers via a helper CDN.