Key Concepts:
ES:
es--elementary Streams (Raw stream) is a data stream that comes directly from the encoder, which can be an encoded video data stream (H.264,mjpeg, etc.), an audio data stream (AAC), or other encoded data stream collectively. After the ES stream passes through the PES packager, it is converted into a PES package.
ES is a data stream that contains only one content, such as video only or audio only, and the PES after packaging is only one of the properties of ES, such as PES with video es only, pes with audio es only. Each ES is made up of several access units (AU) , each video au or audio au is composed of the head and coded data two parts, 1 AU equivalent to encode 1 video images or 1 audio frames, it can be said that each AU is actually encoded data stream display unit, This is the equivalent of 1 video images decoded or 1 audio frames sampled.
PES:
pes--packetized Elementary Streams (grouped es), ES-formed groupings, called PEs groupings, are a data structure used to pass ES. The PES stream is a data stream formed by the processing of the ES stream through the PES Packager, in which the ES stream is grouped, packaged, and added to the header information (the first packaging of the ES stream). The basic unit of the PES stream is the PES package. The PES package consists of Baotou and payload.
PTS, DTS:
pts--presentationtime Stamp (display time stamp) indicates the time at which the display unit appears in the system target decoder (H. MJPEG, etc.).
dts--decoding Time Stamp (decoding timestamp) represents the time that all bytes of the access unit are moved away from the decoding buffer.
Pts/dts is played in the PES packet in the Baotou, these two parameters are to resolve the audio and video synchronization display, to prevent the decoder input cache overflow or underflow key. Each i (keyframe), P (predictive frame), B (bidirectional prediction frame) frame has a pts and DTS, but PTS and DTS are not the same for B frames, no need to mark B-Frame DTS, for I-frames and P-frames, the display must be stored in the video decoder's reorder buffer, After a delay (reorder) and then display it, be sure to mark Pts and DTS separately.
PS:
Ps--program Stream (program stream) PS Flow consists of PS package, and a PS package is made up of several PES packages (here, ES through the two-layer package). The packet header of the PS package contains synchronization information and clock recovery information. A PS package can contain up to 16 video PES packages and 32 audio PES packages with the same 1: benchmark.
Ts:
The Ts--transport stream (the transport Stream) consists of a fixed-length TS Package (188 bytes), while the TS package is a re-encapsulation of the PES package (where ES also passes through the two-layer package). The packet header information for the PES package still exists in the TS package.
The difference between TS flow and PS flow is that the packet structure of TS flow is fixed length, and the packet structure of PS flow is variable length. PS Package due to the change in length, once the synchronization information of a PS packet is lost, the receiver will enter the out-of-step state, resulting in serious information loss events. However, because of the fixed-length packet structure, the receiver can detect the synchronization information in the bread after the transmission error has destroyed the synchronization information of a TS packet, thus recovering the synchronization and avoiding the loss of information. Therefore, in the channel environment is very bad, the transmission error is high when the TS stream is generally used, and in the letter environment is better, transmission error is low when the general use of PS stream.
TS Single-stream, mixed-code stream:
Singularity : The basic component of a TS stream is a TS package with a length of 188 bytes.
Mixing: TS streams are composed of a variety of data, the data in a TS package can be video data, audio data, fill data, psi/si tabular data, etc. (the only PID corresponding).
Process:
1:A/D after conversion, the ES Basic stream is obtained by MPEG-2 compression encoding. This data stream is very large and is just a i,p,b of these video frame or audio sampling information.
2: Through the pes Packager, package and insert the Pts/dts logo into PEs in each frame. It turns out to be a stream format, and now it's a fragmented form of data packets.
3:pes is packaged as a PS or TS package for storage (DVD) or transmission (DVB) as needed. Because each Lu Yin/video contains only one coded stream of data, each PES contains only the corresponding data stream.
The difference between es,pes,ts is that they are subordinate relationships: after the ES packaging is pes;
The PES package PS format is the PS stream;
The PES package into TS format is TS stream;