H.264 stream header

微笑、不失礼 提交于 2019-12-09 00:50:30

问题


I have corrupted video stream with this header / parameters in the beginning.

00 00 00 01 67 64 00 1E AC D9 40 B0 33 FB C0 44  
00 00 03 00 04 00 00 03 00 C8 3C 58 B6 58 00 00  
00 01 68 EB EC B2 2C  

I’m trying to figure out the actual values, but all I have guessed is that

67 – AVC / H264 
64 00 - High Profile
1E – Level 30 (in decimal)  

Does anybody know what other bytes stand for?

At least, how to calculate video dimensions (Width x Height). I thought it should be decimal numbers but apparently it’s not. Or am I all wrong and it doesn’t work this way?


回答1:


You will find answers here:

  • How to decode sprop-parameter-sets in a H264 SDP?
  • Parsing Rtsp response parameter that is sprop-parameter-sets
  • Fetching the dimensions of a H264Video stream

Your data decodes like this:

Sequence Parameter Set

profile_idc 100 
constraint_set0_flag 0 
constraint_set1_flag 0 
constraint_set2_flag 0 
constraint_set3_flag 0 
level_idc 30 
seq_parameter_set_id 0 
chroma_format_idc 1 
// ... 
num_ref_frames 4 
gaps_in_frame_num_value_allowed_flag 0 
pic_width_in_mbs_minus1 43 
pic_height_in_map_units_minus1 24 
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 2 
vui_parameters_present_flag 1 
// ... 

Picture Parameter Set

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



回答2:


If frame_cropping_flag is 1, to get the dimensions you do:

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


来源:https://stackoverflow.com/questions/7923752/h-264-stream-header

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!