In continuation of previous post about C++/WinRT and Telegram, here we with @ParameterSetAnalyzeBot: “Your buddy to extract H.264 parameter set NAL data”. In a chat, it expects an MP4 file with an H.264 video track sent him (her?). Then it extracts data from sample description box and deciphers into readable form:
It’s literally taking the MP4 file to the Media Foundation Source Reader API, pulls MF_MT_MPEG_SEQUENCE_HEADER
and pipe the data to h264_analyze
tool (my fork of it has Visual Studio 2019 project, and is added ability to take input from stdin
for piping needs).
It will probably not be online forever, but it’s live. Be aware that Telegram limits file transmissions to 20 MB per file at the moment.
!! Found NAL at offset 3 (0x0003), size 31 (0x001F) 0.8: forbidden_zero_bit: 0 0.7: nal->nal_ref_idc: 3 0.5: nal->nal_unit_type: 7 1.8: sps->profile_idc: 77 2.8: sps->constraint_set0_flag: 0 2.7: sps->constraint_set1_flag: 0 2.6: sps->constraint_set2_flag: 0 2.5: sps->constraint_set3_flag: 0 2.4: sps->constraint_set4_flag: 0 2.3: sps->constraint_set5_flag: 0 2.2: reserved_zero_2bits: 0 3.8: sps->level_idc: 31 4.8: sps->seq_parameter_set_id: 0 4.7: sps->log2_max_frame_num_minus4: 3 4.2: sps->pic_order_cnt_type: 0 4.1: sps->log2_max_pic_order_cnt_lsb_minus4: 0 5.8: sps->num_ref_frames: 4 5.3: sps->gaps_in_frame_num_value_allowed_flag: 0 5.2: sps->pic_width_in_mbs_minus1: 79 7.5: sps->pic_height_in_map_units_minus1: 44 8.2: sps->frame_mbs_only_flag: 1 8.1: sps->direct_8x8_inference_flag: 1 9.8: sps->frame_cropping_flag: 0 9.7: sps->vui_parameters_present_flag: 1 9.6: sps->vui.aspect_ratio_info_present_flag: 1 9.5: sps->vui.aspect_ratio_idc: 255 10.5: sps->vui.sar_width: 1 12.5: sps->vui.sar_height: 1 14.5: sps->vui.overscan_info_present_flag: 0 14.4: sps->vui.video_signal_type_present_flag: 1 14.3: sps->vui.video_format: 0 15.8: sps->vui.video_full_range_flag: 0 15.7: sps->vui.colour_description_present_flag: 0 15.6: sps->vui.chroma_loc_info_present_flag: 0 15.5: sps->vui.timing_info_present_flag: 1 15.4: sps->vui.num_units_in_tick: 1 19.4: sps->vui.time_scale: 50 23.4: sps->vui.fixed_frame_rate_flag: 1 23.3: sps->vui.nal_hrd_parameters_present_flag: 0 23.2: sps->vui.vcl_hrd_parameters_present_flag: 0 23.1: sps->vui.pic_struct_present_flag: 0 24.8: sps->vui.bitstream_restriction_flag: 1 24.7: sps->vui.motion_vectors_over_pic_boundaries_flag: 1 24.6: sps->vui.max_bytes_per_pic_denom: 2 24.3: sps->vui.max_bits_per_mb_denom: 1 25.8: sps->vui.log2_max_mv_length_horizontal: 16 26.7: sps->vui.log2_max_mv_length_vertical: 16 27.6: sps->vui.num_reorder_frames: 0 27.5: sps->vui.max_dec_frame_buffering: 4 28.8: rbsp_stop_one_bit: 1 28.7: rbsp_alignment_zero_bit: 0 28.6: rbsp_alignment_zero_bit: 0 28.5: rbsp_alignment_zero_bit: 0 28.4: rbsp_alignment_zero_bit: 0 28.3: rbsp_alignment_zero_bit: 0 28.2: rbsp_alignment_zero_bit: 0 28.1: rbsp_alignment_zero_bit: 0 !! Found NAL at offset 37 (0x0025), size 4 (0x0004) 0.8: forbidden_zero_bit: 0 0.7: nal->nal_ref_idc: 3 0.5: nal->nal_unit_type: 8 1.8: pps->pic_parameter_set_id: 0 1.7: pps->seq_parameter_set_id: 0 1.6: pps->entropy_coding_mode_flag: 1 1.5: pps->pic_order_present_flag: 0 1.4: pps->num_slice_groups_minus1: 0 1.3: pps->num_ref_idx_l0_active_minus1: 0 1.2: pps->num_ref_idx_l1_active_minus1: 0 1.1: pps->weighted_pred_flag: 0 2.8: pps->weighted_bipred_idc: 0 2.6: pps->pic_init_qp_minus26: 0 2.5: pps->pic_init_qs_minus26: 0 2.4: pps->chroma_qp_index_offset: 0 2.3: pps->deblocking_filter_control_present_flag: 0 2.2: pps->constrained_intra_pred_flag: 0 2.1: pps->redundant_pic_cnt_present_flag: 0 3.8: rbsp_stop_one_bit: 1 3.7: rbsp_alignment_zero_bit: 0 3.6: rbsp_alignment_zero_bit: 0 3.5: rbsp_alignment_zero_bit: 0 3.4: rbsp_alignment_zero_bit: 0 3.3: rbsp_alignment_zero_bit: 0 3.2: rbsp_alignment_zero_bit: 0 3.1: rbsp_alignment_zero_bit: 0
Maybe it is worth adding full Media Foundation attribute printout as well, and similar H.265/HEVC data. This will have to wait for next occasion though.
And – yeah – it does have support for fragmented MP4 too: