The difference between h264 and h265 decoding

Briefly explain the difference between h264 and h265 decoding

h264

I used an analysis tool to analyze the h264 file and found:
insert image description here
insert image description here

In fact, it is SPS+PPS+SEI+IDR+P+B+P+B+P+B... SPS+PPS+I+P+B+P+B... This cycle, in which SEI only needs to be sent once, that is In the first frame, both IDR and I frames are so-called I frames. In order to distinguish the first I frame, it is called an IDR frame. SEI only needs to be brought before the IDR frame, and there will be I frame, the rest are P frame + B frame cycle.

h265

insert image description here
insert image description here

h265 is actually a sequence with an extra vps, a video parameter set, which is mainly used to transmit video classification information, which is conducive to the expansion of compatible standards in scalable video coding or multi-viewpoint video. It becomes VPS+SPS+PPS+SEI+IDR+P+B+P+B...VPS+SPS+PPS+SEI+CAR+P+B+P+B..., CAR is similar to I frame, type= 19 and 20 are all I frames, and 21 is CAR.

So far we have found that h265 sends VPS and SEI every time, and what is sent in a loop later is not necessarily I frame.

WAVES

Each SPS, PPS, and IDR is a NALU. Normally, the format of the NALU is: start code + NALU header + NALU data. So to get the stream, you only need to parse out the NALU and get the header information normally, which is very simple.
The start code is usually 00 00 01 or 00 00 00 01, and the NALU header data can be used to determine whether it is VPS, SPS, or PPS. But it should be noted that the h264 header length is different from the h265 header length.

How to judge whether the video stream is H264 or H265

Usually it is to judge whether the type decimal in the NALU header is 32 (VPS), then it is h265, or the SEI decimal is 6 or 39, 6 is h264, etc.

Guess you like

Origin blog.csdn.net/Janix520/article/details/126008938