獲取HEVC視頻的ParameterSets

獲取ParameterSets

        HEVC視頻存放SPS,PPS的數據結構與H264類似

官方定義參考 https://lists.matroska.org/pipermail/matroska-devel/2013-September/004567.html

HEVCDecoderConfigurationRecord:

// The CodecPrivate syntax shall follow the

// syntax of HEVCDecoderConfigurationRecord

// defined in ISO/IEC 14496-15.

//

// The number zero (0) shall be written to

// the configurationVersion variable until

// official finalization of 14496-15, 3rd ed.

//

// After its finalization, this field and the

// following CodecPrivate structure shall

// follow the definition of the

// HEVCDecoderConfigurationRecord in 14496-15.

unsigned int(8) configurationVersion;

unsigned int(2) general_profile_space;

unsigned int(1) general_tier_flag;

unsigned int(5) general_profile_idc;

unsigned int(32) general_profile_compatibility_flags;

unsigned int(48) general_constraint_indicator_flags;

unsigned int(8) general_level_idc;

bit(4) reserved = ‘1111’b;

unsigned int(12) min_spatial_segmentation_idc;

bit(6) reserved = ‘111111’b;

unsigned int(2) parallelismType;

bit(6) reserved = ‘111111’b;

unsigned int(2) chromaFormat;

bit(5) reserved = ‘11111’b;

unsigned int(3) bitDepthLumaMinus8;

bit(5) reserved = ‘11111’b;

unsigned int(3) bitDepthChromaMinus8;

bit(16) avgFrameRate;

bit(2) constantFrameRate;

bit(3) numTemporalLayers;

bit(1) temporalIdNested;

unsigned int(2) lengthSizeMinusOne;

unsigned int(8) numOfArrays;

for (j=0; j < numOfArrays; j++) {

bit(1) array_completeness;

unsigned int(1) reserved = 0;

unsigned int(6) NAL_unit_type;

unsigned int(16) numNalus;

for (i=0; i< numNalus; i++) {

unsigned int(16) nalUnitLength;

bit(8*nalUnitLength) nalUnit;

}

}

         存放在extradata中,對應FFmpeg中AVCodecContext結構體的extradata數據段。

        我們需要解析其中的SPS,PPS,VPS,作爲ParameterSets傳給解碼器完成創建工作。從上述的定義我們可以直接跳過21個字節,遍歷之後的數據段,根據的NAL_unit_type類型32、33、34別對應VPS、SPS和PPS,獲取所有SPS,PPS,VPS。

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章