如何在H.264流中使用SPS,PPS信息计算视频尺寸

ger*_*don 2 video 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
Run Code Online (Sandbox Code Playgroud)

我正在尝试找出实际值,但我没有。

有人知道其他字节代表什么吗?

我想知道如何计算视频尺寸(宽x高)。

Rom*_* R. 5

干得好:

### 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: ... 
Run Code Online (Sandbox Code Playgroud)

它是1920x1080的视频:您基本上可以解析出每个规范的值,然后按照本文中的描述计算尺寸:提取H264Video流的尺寸

特别:

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
Run Code Online (Sandbox Code Playgroud)

让你120 * 16通过68 * 16 - 8(假设4:2:0色彩取样)。

2014-10-10 UPD:我在编辑/评论中提出这一点:

从场到帧的转换(2 - frame_mbs_only_flag)也应用于裁剪区域。subWidthC和subHeightC的x2仅用于颜色采样4:2:0。4:4:4、4:2:2和Monochrome将x1用于x2中的一个或两个。