2014-02-14 128 views
1

我在開始時使用此標頭/參數破壞了視頻流。如何使用SPS,PPS信息在H.264流中計算視頻尺寸

[sps] 
00 00 00 01 
67 64 00 2A AD 84 01 0C 20 08 61 00 43 08 02 18 40 10 C2 00 84 2B 50 3C 01 13 F2 C2 00 00 03 00 02 00 00 03 00 79 08 

[pps] 
68 EE 3C B0 

我試圖找出實際值,但我沒有。

有沒有人知道其他字節代表什麼?

我想知道如何計算視頻尺寸(寬x高)。

+0

可能出現[從H.264 NALU獲取視頻的寬度/高度]的副本(http://stackoverflow.com/questions/12018535/get-the-width-height-of-the-video-從-H-264-NALU) – mpromonet

回答

3

在這裏你去:

### Sequence Parameter Set 

profile_idc 100 
constraint_set0_flag 0 
constraint_set1_flag 0 
constraint_set2_flag 0 
constraint_set3_flag 0 
level_idc 42 
seq_parameter_set_id 0 
chroma_format_idc 1 
// TODO: ... 
// TODO: ... 
num_ref_frames 1 
gaps_in_frame_num_value_allowed_flag 1 
pic_width_in_mbs_minus1 119 
pic_height_in_map_units_minus1 67 
frame_mbs_only_flag 1 
direct_8x8_inference_flag 1 
frame_cropping_flag 1 
frame_crop_left_offset 0 
frame_crop_right_offset 0 
frame_crop_top_offset 0 
frame_crop_bottom_offset 4 
vui_parameters_present_flag 1 
// TODO: ... 

### Picture Parameter Set 

pic_parameter_set_id 0 
seq_parameter_set_id 0 
entropy_coding_mode_flag 1 
num_slice_groups_minus1 0 
// TODO: ... 

這是1920×1080視頻:基本上你分析出每個規格的值,然後計算出在這篇文章中描述的尺寸:Fetching the dimensions of a H264Video stream

具體做法是:

width = ((pic_width_in_mbs_minus1 + 1) * 16) 
    - (frame_crop_left_offset + frame_crop_right_offset) * 2 
height= (2 - frame_mbs_only_flag) * ((pic_height_in_map_units_minus1 + 1) * 16) 
    - (frame_crop_top_offset + frame_crop_bottom_offset) * 2 

讓你120 * 1668 * 16 - 8(假設4:2:0顏色採樣)。

2014年10 UPD:我把這種向上從編輯/註釋:

轉換從場到幀(2 - frame_mbs_only_flag)被施加到剪切區域爲好。 subWidthC和subHeightC的x2僅適用於顏色採樣4:2:0。 4:4:4,4:2:2,而單色使用x1表示一個或兩個x2。