H263/H264Header解析(h264_mp4toannexb_filter)

函数h264_mp4toannexb_filter详解   

 1、ffmpeg中处理h264码流分为两种情况 
  a、没有extradata则直接把packet中的数据交给解码器
  b、如果有extradata,则需要把sps和pps的数据分析出来,连同packet.data一起交给解码器

 2、如何从extradata中分离sps and pps,分两种情况 
  a、sps and pps 都有的情况(假设sps和pps都有2个units,下同)

H263/H264Header解析(h264_mp4toannexb_filter)_第1张图片   
 b、没有sps的情况   
H263/H264Header解析(h264_mp4toannexb_filter)_第2张图片

3、如何组合packet.data,假如有2个nal,sps与pps的unit num均为1 
H263/H264Header解析(h264_mp4toannexb_filter)_第3张图片 

H263 Header       
  Bit 1    Always "1", in order to avoid start code emulation. 
  Bit 2    Always "0", for distinction with ITU-T Rec. H.261. 
  Bit 3    Split screen indicator, "0" off, "1" on. 
  Bit 4    Document camera indicator, "0" off, "1" on. 
  Bit 5    Full Picture Freeze Release, "0" off, "1" on. 
  Bits 6-8    Source Format, "000" forbidden, "001" sub-QCIF, "010" QCIF, "011" CIF, "100" 4CIF, "101" 16CIF, "110" reserved, "111" extended PTYPE. If bits 6-8 are not equal to "111", which indicates an extended PTYPE (PLUSPTYPE), the following five bits are also present in PTYPE
  Bit 9    Picture Coding Type, "0" INTRA (I-picture), "1" INTER (P-picture). 
  Bit 10    Optional Unrestricted Motion Vector mode (see Annex D), "0" off, "1" on. 
  Bit 11    Optional Syntax-based Arithmetic Coding mode (see Annex E), "0" off, "1" on. 
  Bit 12    Optional Advanced Prediction mode (see Annex F), "0" off, "1" on. 
  Bit 13    Optional PB-frames mode (see Annex G), "0" normal I- or P-picture, "1" PB-frame. 
 

你可能感兴趣的:(贝海拾遗)