MPEG
Video Resolution
MPEG-2 Transport Stream
the order of frame transmission must be different to the order they appear on the tv screen:
- I and P frames must arrive first. In order for a decoder to reconstruct a B-frame from the preceding I and following P frames
- The Decode Time Stamp (DTS) tells the decoder when to decode the frame Because the frames arrived are not in the display order
- The Presentation Time Stamp (PTS) tells the decoder when to display the frame
- The Program Clock Reference (PCR) allow a time reference to be created
- The PTS and DTS are added to the Packetised Elementary Stream
- the Programme Clock Reference (PCR) is contained in the Transport stream.
Packetized Elementary Stream (PES) is a specification in the MPEG-2 Part 1 (Systems) (ISO/IEC 13818-1) and ITU-T H.222.0[1][2] that defines carrying of elementary streams (usually the output of an audio or video encoder) in packets within MPEG program streams(PS) and MPEG transport streams(TS).
An elementary stream (ES) as defined by the MPEG communication protocol is usually the output of an audio encoder or video encoder.
An ES contains only one kind of data (e.g. audio, video, or closed caption).
Programme Identifiers (PID) are used to identify a particular PID stream:
- PID = 0 the Programme Association Table PID. The PAT contains the PIDs of all the Program Map Table (PMT). In the ex., the PMT for program 1 is identified via the PID 22
- Program 1's PMT contains all the PID's for Program 1's video, audi, data packets and timing information. These must be put together to reconstruct the PES.
- Program 1's PCR is identified by the PID 31
- PCR is a clock recovery mechanism for MPEG programs. When a program is encoded, a 27MHz System Time Clock (STC) drives the encoding process. When the program is decoded (or remultiplexed), the decoding process must be driven by a clock which is locked to the encoder's STC. The decoder uses the PCR to regenerate a local 27MHz clock.
- When a program is inserted into the Transport Stream a 27MHz timestamp is inserted - the PCR. At the decoder end, it uses a Voltage Controlled Oscillator (VCXO) to generate a 27MHz clock. When a PCR is received, it is compared to a local counter which is driven by the VCXO, and the difference is used to correct the frequency of the VCXO to ensure that the 27MHz clock is locked to the PCR.
- The PCR field is a 42 bit field in the adaptation field of the Transport Stream. The PCR field consists of a 9 bit part that increments at a 27MHz rate and a 33 bit part that increments at a 90kHz rate (when the 27MHz part rolls over).
Cut part from video file from start position to end position with FFmpeg
Use this to cut video from [start] for [duration]:ffmpeg -ss [start] -i in.mp4 -t [duration] -c copy out.mp4Here, the options mean the following:
- -ss specifies the start time, e.g. 00:01:23.000 or 83 (in seconds)
- -t specifies the duration of the clip (same format).
- -to Instead of -t you can also supply the end time with -to.
- -c copy copies the first video, audio, and subtitle bitstream from the input to the output file without re-encoding them. This won't harm the quality and make the command run within seconds.
留言