How H264 (ES) packaged into H264 (PES)

Source: Internet
Author: User
how H264 (ES) packaged into H264 (PES)

has been on the internet to collect all kinds of information, heart tired ah. The following nine locks are very complicated for you to explain the unknown relationship between TS and H264. First, the overall general diagram

This I do not know is in which CSDN master that get the figure, helped me a lot of busy, on the picture time to:

How to encapsulate the PES data by ES data

1 , how to extract a frame es data, is so simple ...

[CPP]  View plain  copy  print? #include   "stdafx.h"    #include  <stdio.h>   #include  <stdlib.h>    #include  <string.h>      typedef struct   {     int startcodeprefix_len;      //! 4 for  parameter sets and first slice in picture, 3 for everything  else  (suggested)      unsigned len;                  //! Length of the NAL  unit  (excluding the start code, which does not belong to the  nalu)      unsigned max_size;             //! Nal Unit Buffer size            int forbidden_bit;             //! should be always FALSE     int nal_ reference_idc;        //! nalu_priority_xxxx      int nal_unit_type;            //!  nalu_type_xxxx             char *buf;                     // ! contains the first byte followed by the ebsp      unsigned short lost_packets;  //! true, if packet loss is  detected  } nalu_t;      file *bits = null;                 //!< the bit stream  file   static int findstartcode2  (UNSIGNED&NBSP;CHAR&NBSP;*BUF);//Find start character 0x000001    static int findstartcode3  (UNSIGNED&NBSP;CHAR&NBSP;*BUF);//Find start character 0x00000001  // static bool flag = true;   static int info2=0, info3=0;          Nalu_t *allocnalu (int buffersize)    {      nalu_t *n;        if  ((n =  (nalu_t*) calloc  (1,  sizeof  (nalu_t))  == null)      {          printf ("Allocnalu: n");         exit (0);      }        n->max_size=buffersize;        if   (n->buf =  (char*) calloc  (buffersize, sizeof  (char)))  == null)      {       free  (n);       printf   ("Allocnalu: n->buf");       exit (0);     }         return n;  }  

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.