"If you need to reprint, please indicate: https://blog.csdn.net/qq_29350001/Article/details/78221863
This part of H.264 has been talking, but there is no system. Next, we must detail.
See: H.264 Video Compression Standard
First, introduction
H.264 is the latest video compression standard, which is also known as MPEG-4 Part 10 or AVC (Advanced Video Coding). It is predicted that H.264 will become the industry's preferred video standard in the next few years. H.264 is an open standard that requires licenses to support the most efficient video compression technologies in the most market market. In the case where the image quality does not affect the image quality, the H.264 encoder can reduce the size of the digital video files by 80% and more than 50%, respectively, compared to the M-JPEG and MPEG-4 Part 2 standard. This means that the network bandwidth and storage space required for video files will be greatly reduced. Or from another perspective, at a particular bit rate, the video image quality will be significantly improved. H.264 is jointly developed by standardized organizations in telecommunications and IT industries, and H.264 is expected to be broader than previous standards. H.264 has been applied to a new generation of electronic products such as mobile phones and digital video players, and quickly get favors of the ultimate users. Service providers such as online video storage companies and telecommunications companies have also begun to adopt H.264 standards. In the video surveillance industry, H.264 will probably apply to those who require high frame speed and high resolution, such as highways, airports, and entertainment venues. For these monitoring places, frame speeds with 30/25 FPS (NTSC / PAL) have become a standard. However, since H.264 can reduce bandwidth and storage requirements, it has significant economics, so it can help companies maximize costs. In addition, since the extremely efficient compression technique of H.264 can perform a large proportional compression and reduction of large files without affecting image quality, it is expected to increase the popularity of millions of pixel cameras. However, things have their own two sides. Although H.264 can save network bandwidth and storage costs, it puts higher performance requirements for network cameras and display terminals.
Second, the development of H.264
H.264 is a new generation of video compression criteria for ITU-T video coding expert group (VCEG) and ISO / IEC moving image expert group (MPEG). ITU-T is a department that represents the international telecommunications alliance to formulate telecommunications standards. ISO refers to an international standardization organization. IEC refers to the International Electrotechnical Commission, which is responsible for the development of all electronic, electrical and related technologies. H.264 is the name used by ITU-T, while ISO / IEC named MPEG-4 Part 10 / AVC because it represents a new standard in the MPEG-4 series standard. The MPEG-4 series standard includes MPEG-4 Part 2 and other standards, MPEG-4 Part 2 is a standard for IP-based video encoders and webcams. Be
In order to solve the shortcomings in the previous video compression standard, the goal of H.264 is support:> High-efficiency compression, under a particular video quality, the bit rate can be reduced by 50% compared to any other video standard. > More powerful fault tolerance, enactment of various network transmission errors> low time delay function, and can provide higher quality images with higher quality images> Simplified implementation> Exact match decoding, with simple syntax specification Strictly specify how the encoder and decoder perform numeric calculations to avoid errors
In addition, H.264 can also flexibly support various monitoring applications with different bit rate requirements. For example, in entertainment video applications (including broadcast, satellite TV, cable TV and DVD), H.264 can achieve 1-10 Mbit / second performance with high delay. For telecommunications services, H.264 can achieve a bit rate of less than 1 Mbit / second at a low time delay.
Be
Third, the working principle of video compression
Video compression is achieved by reducing and removing redundant video data, achieving the purpose of efficiently sending and storeing digital video files. During the compression process, it is necessary to apply a compression algorithm to compress the source video to create a compressed file for transmission and storage. To play the compressed file, you need to apply the opposite decompression algorithm to restore the video, and the restored video content is almost identical to the original source video content. The time required to compress, transmit, decompress, and display file is referred to as delay. Under the same processing capability, the compressed algorithm is higher, the longer the delay.
Be
The video codec (encoder / decoder) refers to the compression-decompression algorithm of two collaborative operations. Video codecs using different standards typically not compatible with each other; that is, video content for compression using a standard cannot be extracted with another standard. For example, the MPEG-4 Part 2 decoder cannot work with the H.264 encoder. This is because an algorithm does not decode the output signal of another algorithm, but we can use a variety of different algorithms in the same software or hardware to support compression of multiple formats. Since different video compression criteria use different methods to reduce the amount of data, the compression results are different in terms of bit rate, quality, and delay.
In addition, since the encoder's designer may choose to use a different toolset defined using a standard, even if the encoder with the same compression criterion, there may be differences. However, different embodiments can be employed as long as the encoder's output signal meets the standard format and the decoder's requirements. This is very advantageous because different embodiments can achieve different goals to meet different budget requirements. For non-real-time professional software encoders for managing photologies, you should provide higher quality encoding videos than real-time hardware encoders for video conferencing in the handheld device. Therefore, even a specified criteria cannot guarantee the provision of the specified bit rate or quality. Moreover, if the implementation is not determined in advance, a standard cannot perform the correct performance comparison with other criteria, or even correct performance comparison with other embodiments of the same standard. Unlike the encoder, the decoder must implement all the required parts of a standard to decode standard bitstreams. This is because it is clear that the compression algorithm should be reduced for each bit of compressed video.
The figure below is compared with the same image quality level, the bit rate comparison of the following video standards: M-JPEG, MPEG-4 PART 2 (no motion compensation), MPEG-4 Part 2 (with motion compensation) and H.264 (baseline kind).
Above the figure, for the video sequence, the use of the H.264 encoder can reduce the 50% bit rate (BPS) than the MPEG-4 encoder with motion compensation. In the case where there is no exercise compensation, the H.264 encoder is 3 times higher than that of the MPEG-4 encoder, 6 times higher than the M-JPEG encoder.
Be
Fourth, H.264 Category and Level
Participation in the development of the joint organization of the H.264 standard is committed to creating a simple solution to maximize the number of options and features. As with other video standards, an important aspect of the H.264 standard is to support common applications and universal formats through the functions provided in category (algorithm feature set) and grade (performance level). H.264 has 7 categories, and each category is for a particular application. In addition, each category defines which features set, and limits the complexity of the decoder in implementation. The webcam and video encoders are most likely to use the benchmark category, this category is mainly for the limited application of the computing resource. For real-time encoders embedded in a network video product, the benchmark category is most applicable to specific availability performance. This category can achieve low delays, which is especially important for monitoring video, and is especially important for translation / tilt / zoom (PTZ) control to support the PTZ network camera. H.264 is divided into 11 functional levels, limiting performance, bandwidth and memory requirements. Each level specifies a bit rate and coding rate (number of macroblocks per second) from various resolutions such as QCIF to HDTV. The higher the resolution, the higher the required level.
Be
Be
V. Basic knowledge of frames
Be
This section has been there, see: image and streaming media - I frame, B frame, P frame, IDR frame difference
Be
According to different categories of H.264, the encoder uses different types of frames, such as I frames, P frames, and B frames. I frame (intra encoding frame) is a separate frame that comes with all information, and can decode independently without referring to other images. The first frame in the video sequence is always I frame. If the transmitted bitstream is destroyed, you need to use I frames as the starting point or resynchronization point of the new viewer. I frames can be used to implement fast forward, rewinding, and other random access functions. If the new client will participate in the video stream, the encoder will automatically insert the I frame in the same time interval or according to the requirements. The disadvantage of I frame is that they take up more data bits, but from another aspect, I frames do not generate a sense of fuzzy.
Be
The P frame (inter predictive encoding frame) requires a reference to different portions of the previous I frame and / or P frames to encode. Compared to I frames, the P frame typically takes less data bits, but it is disadvantage that since the P frame has complex dependence on the previous P and I reference frames, it is very sensitive to the transmission error.
The B frame (two-way predictive coding frame) requires simultaneous frames, and the following frames as reference frames.
The above figure, a typical video sequence with I frame, B frame, and P frames. The P frame only needs to refer to the previous I frame or P frame, and the B frame requires simultaneous reference to the front and rear I frames or P frames.
When the video decoder is decoded one by one frame, it must always be decoded from the I frame when the bit stream is decoded one by one frame. If P frame and B are used, you must decode together with the reference frame. In the H.264 reference class, only I frames and P frames are used. Since the reference class does not use the B frame, low delays can be achieved, so it is ideal for the network camera and video encoder.
Be
Then, see: FFMPEG Reproduction - Vision Audio Basic Knowledge
You can also view the H.264 code stream analysis information by video coding data tool Elecard Stream Eye.
Be
Red frame: I frame; blue frame: P frame; green frame: B frame.
Be
Be
6. Basic methods of reducing data quantity
The amount of video data can be reduced within an image frame or between a series of frames by various methods. In an image frame, you only need to delete unnecessary information, but you can reduce the amount of data, but this will result in a decrease in the resolution of the image. In a series of frames, the amount of video data can be reduced by differential encoding, and most of the video compression criteria including H.264 are employed. In the differential encoding, one frame is compared to the reference frame (i.e., the previous I frame or P frame), and then encodes only the pixels that have changed more than the reference frame. In this way, the pixel values that need to be encoded and transmitted can be reduced.
Be
Above the figure, the three images in the above sequence are encoded and transmitted as a stand-alone image (I frame), respect each other, respectively.
On the above figure, only the first image (I frame) is encoded by the first image (I frame) is to encode only the full frame image information. In the two images (P frames), the static portion (ie, the house) will refer to the first image, and only the motion vector is encoded using the motion vector, thereby reducing transmission and storage. The amount of information.
If the difference is detected according to the pixel block (macroblock) instead of a single pixel, it can further reduce the amount of information required to encode; therefore, a larger area can be compared, but only the existence The block is encoded. In addition, the relevant overhead of marking the region where the change occurs will also be greatly reduced.
However, if there is a lot of object motion in the video, the differential encoding will not significantly reduce the amount of data. At this time, block-based motion compensation techniques can be employed. Based on the block-based motion compensation takes into account the large amount of information constituting new frames in the video sequence, it can be found in the previous frame, but may be in different locations. Therefore, this technique is divided into a series of macroblocks. Then, by blocking a block in the reference frame, a new frame (e.g., a P frame) is constructed blocks them block by blocks. If the matching block is found, the encoder only needs to encode the position of the matching block in the reference frame. Compared to the actual content of the block, only the data bits of the occupied motion can be reduced.
Above the figure, the three images in the above sequence are encoded and transmitted as a stand-alone image (I frame), respect each other, respectively.
Be
Seven, H.264 efficiency
H.264 increases video compression technology to a new height. In H.264, I frame will be encoded by a new advanced intra prediction method. This method can greatly reduce the data bits of I frames and maintain high quality by continuously predicting smaller pixels in each macroblock in the frame. This can be achieved by looking for a matching pixel in the first few coded pixels adjacent to the new 4 × 4 pixel blocks encoded in the frame. By repeating the encoded pixel value, you can greatly reduce the number of bits that need to be encoded. The new intra prediction function is a key part of the H.264 technology, and the experiment has proven to be very effective. Compared to the M-JPEG video stream using only I frame, only the file size of the H.264 video stream of the I frame is much smaller.
Be
Above the figure, in the macroblock composed of 16 pixel blocks, the diagram of several modes employed in the intra prediction of 4 × 4 pixels in one of the 1 pixel blocks is performed. In the 16 pixel blocks of the macroblock, each pixel block can be encoded using different modes.
The above figure, the above is the efficiency diagram of the H.264 intra prediction method. In this way, the intra predictive image will be "free". You can generate an output image with just encoding the residual image and the intra prediction mode.
The block-based motion compensation used when the P frame and the B frame is encoded, and improved is also improved in H.264. H.264 encoder can be in oneOr a small number of or numerous areas of a plurality of reference frames, search for matching blocks at a low to sub-pixel. In order to improve the matching rate, the size and shape of the block can be adjusted. In the reference frame, a macroblock encoded within the frame is used for the area where the matching block is not found. H.264 Based on block-based motion compensation has a high degree of flexibility, it is very suitable for the crowd comparing a crowded monitoring place because it guarantees high quality to meet stringent application requirements. Motion compensation is an aspect of the most stringent aspect of the video encoder, and the H.264 encoder performs different ways of motion compensation and its implementation level, which will affect the efficiency of video compression.
For H.264, image fuzzy phenomena that usually appear in highly compressed video using M-JPEG and MPEG standards (rather than H.264 standard) can be reduced by using the ring. This filter can make the edge edges smoothed by adaptive strength, thereby ensuring that the output is almost perfect and unzurked.
Above the figure, we can see from the right picture, after the application of the deck effect filter, the block effect of the highly compressed image in the left figure has been greatly reduced.
Be
Eight, summary
H.264 represents a major leap in video compression technology. Since this technology has more accurate predictive capabilities and higher fault tolerance, higher compression efficiency can be achieved. It will probably drive the video encoder to further develop forward, so that higher quality video streams, higher frame speeds, and higher resolutions can be provided at the same bit rate (compared to previous criteria); or Conversely, it is possible to drop low bit rate at the same video quality.
Be
H.264 is a general international standard that ITU, ISO, and IEC will jointly develop in video compression. Due to its highly flexibility, H.264 has been widely used in various fields, such as HD DVDs, digital video broadcasts (including HD TV), online video storage (such as YouTube), 3G mobile phone, Software (such as QuickTime, Flash and Apple Macos X operating system, etc.), as well as household TV games (such as PlayStation 3, etc.). With the support of many industries, and under the promotion of applications that meet the needs of individual consumers and professional users, H.264 is expected to replace other compression standards and methods used in today's market.
With the H.264 format more widely applied to webcams, video encoders, and video management software, system designers and integrators will need to ensure that they choose the product and manufacturers to support this new open standard. For now, it is possible to support H.264 and M-JPEG network video products with the highest flexibility and integration capabilities, so it is ideal for users.
If you need to reprint, please indicate the source: https://blog.csdn.net/qq_29350001/article/details/78221863 "
Our other product: