Audio and video master class 07- video stream H264 stream analysis actual combat

[External link picture transfer failed, the source site may have an anti-leeching mechanism, it is recommended to save the picture and upload it directly (img-ahYhw27s-1649949572379)(img/70.png)]

  1. 2.1 H.264 stream structure diagram

[External link picture transfer failed, the source site may have an anti-leeching mechanism, it is recommended to save the picture and upload it directly (img-m0RFjX5f-1649949572380)(img/71.png)]

Start code: If the Slice corresponding to the NALU is the start of a frame, it is represented by 4 bytes, that is, 0x00000001; otherwise, it is represented by 3 bytes, 0x000001. NAL Header: forbidden_bit, nal_reference_bit (priority), nal_unit_type (type). Unpacking operation: In order to make the NALU body not include the start code, whenever two bytes (continuous) of 0 are encountered during encoding, a byte 0x03 is inserted to distinguish it from the start code. When decoding, the corresponding 0x03 is deleted.

[External link picture transfer failed, the source site may have an anti-theft link mechanism, it is recommended to save the picture and upload it directly (img-THdX3cfP-1649949572381)(img/72.png)]

The nal_reference_idc (NRI) of the H.264 decoded NAL header information is used to mark the importance of a NAL unit during the reconstruction process,

  1. A value of 0 indicates that this NAL unit is not used for prediction, so it can be discarded by the decoder without error propagation;
  2. Values ​​higher than 0 indicate that the NAL unit is to be used for drift-free reconstruction, and the higher the value, the greater the impact of this NAL unit loss.
  3. The hidden bit of the NAL header information is 0 by default in the H.264 encoder. When the network recognizes that there is a bit error in the unit "Android Study Notes Summary + Latest Mobile Architecture Video + Dachang Android Interview Questions + Project Actual Combat Source Code Handouts "Open source , it can be set to 1. Hidden bits are mainly used to adapt to different types of network environments (such as the Android open source project: ali1024.coding.net/public/P7/Android/git wired and wireless environment).

[External link picture transfer failed, the source site may have an anti-leeching mechanism, it is recommended to save the picture and upload it directly (img-qzkLKPs4-1649949572383)(img/73.png)]

The process of NAL unit decoding is as follows: first extract the RBSP syntax structure from the NAL unit, and then process the RBSP syntax structure according to the flow shown in FIG. 4 . The input is the NAL unit, and the output result is the sample point of the decoded current image. The NAL unit contains a sequence parameter set and an image parameter set respectively. The image parameter set and sequence parameter set are used as a reference during the transmission of other NAL units. In the headers of these data NAL units, the image parameter set numbers used by them are set through the syntax element pic_parameter_set_id; and corresponding to each image parameter set, The sequence parameter set number they use is set via the syntax element seq_paramter_set_id.

A few examples:

img

3. ffmpeg parses H264 process analysis

This is an actual code stream

img

at last

Finally, here is the information I reviewed during this period of time. This information was shared with me by a friend by chance. It contains the analysis of the real interview questions of Tencent, ByteDance, Ali, and Baidu in 2020-2021, and organizes each technical point. It became a video and PDF (knowledge context + many details).

There are also  advanced architecture technology advanced brain maps and advanced advanced architecture materials  to help you learn and advance. Here I also share it with you for free and save you the time to search for information on the Internet to learn, and you can also share it with your friends to learn together.

Encourage each other together~

[External link image transfer...(img-gu43bgGG-1649949572384)]

Encourage each other together~

Guess you like

Origin blog.csdn.net/m0_61111814/article/details/124184599