Log in

View Full Version : Question of mixed slice of coded field and coded frame


orbitlee
22nd August 2006, 12:10
I demuxed raw h264 elementary stream from one h264 ts, then try to use mp4box to mux into mp4. I found that both coded field slices(field_pic_flag=1) and coded frames slides(field_pic_flag=0) are existed in same h264 elementary stream. mp4box will always treat two field slices(top field and bottom field) as two samples, even if these two slices belongs to one frame(they have same frame_num). This will cause incorrect timing, since the frame rate is actually halved for field slices. Is this a bug of mp4box? Are there any workaround to force treat two slices as one sample(I prefer a perfect CFR mp4), or I must use VFR mp4?

Thanks for your suggestion.

bond
22nd August 2006, 18:54
is your problem the same as this:
http://sourceforge.net/tracker/index.php?func=detail&aid=1535048&group_id=84101&atid=571738

?

orbitlee
23rd August 2006, 08:29
Yes, I think both problems should be same reason. Just wondering how mp4box find out all slices which belong to same frame/sample.

bond
23rd August 2006, 17:54
Yes, I think both problems should be same reason. Just wondering how mp4box find out all slices which belong to same frame/sample.there is a flag saying so

use h264_parse from mpeg4ip on raw streams to see this flag (and more)

orbitlee
23rd August 2006, 19:19
May I know which flag you mentioned?
I cut a small piece of h264 raw stream which contains two access unit, here is the parse log. Should be two frames, but actually 4 fields are coded.


Nal length 6 start code 4 bytes
ref 0 type 9 Access unit delimeter
primary_pic_type: 0
Nal length 29 start code 4 bytes
ref 3 type 7 Sequence parameter set
profile: 77
constaint_set0_flag: 0
constaint_set1_flag: 1
constaint_set2_flag: 0
constaint_set3_flag: 0
level_idc: 40
seq parameter set id: 0
log2_max_frame_num_minus4: 8
pic_order_cnt_type: 0
log2_max_pic_order_cnt_lsb_minus4: 5
num_ref_frames: 2
gaps_in_frame_num_value_allowed_flag: 0
pic_width_in_mbs_minus1: 119 (1920)
pic_height_in_map_minus1: 33
frame_mbs_only_flag: 0
derived height: 1088
mb_adaptive_frame_field_flag: 0
direct_8x8_inference_flag: 1
frame_cropping_flag: 0
vui_parameters_present_flag: 1
aspect_ratio_info_present_flag: 1
aspect_ratio_idc:1
overscan_info_present_flag: 1
overscan_appropriate_flag: 1
video_signal_info_present_flag: 1
video_format: 5
video_full_range_flag: 1
colour_description_present_flag: 1
colour_primaries: 1
transfer_characteristics: 1
matrix_coefficients: 1
chroma_loc_info_present_flag: 1
chroma_sample_loc_type_top_field: 0
chroma_sample_loc_type_bottom_field: 0
timing_info_present_flag: 1
num_units_in_tick: 1
time_scale: 50
fixed_frame_scale: 1
nal_hrd_parameters_present_flag: 0
vcl_hrd_parameters_present_flag: 0
pic_struct_present_flag: 0
Nal length 8 start code 4 bytes
ref 3 type 8 Picture parameter set
pic_parameter_set_id: 0
seq_parameter_set_id: 0
entropy_coding_mode_flag: 1
pic_order_present_flag: 0
num_slice_groups_minus1: 0
num_ref_idx_l0_active_minus1: 1
num_ref_idx_l1_active_minus1: 0
weighted_pred_flag: 0
weighted_bipred_idc: 0
pic_init_qp_minus26: 0
pic_init_qs_minus26: 0
chroma_qp_index_offset: 0
deblocking_filter_control_present_flag: 1
constrained_intra_pred_flag: 0
redundant_pic_cnt_present_flag: 0
Nal length 2239 start code 4 bytes
ref 3 type 5 Coded slice of an IDR picture
first_mb_in_slice: 0
slice_type: 2 (I)
pic_parameter_set_id: 0
frame_num: 0 (12 bits)
field_pic_flag: 1
bottom_field_flag: 0
idr_pic_id: 0
pic_order_cnt_lsb: 0
Nal length 11629 start code 4 bytes
ref 3 type 5 Coded slice of an IDR picture
first_mb_in_slice: 600
slice_type: 2 (I)
pic_parameter_set_id: 0
frame_num: 0 (12 bits)
field_pic_flag: 1
bottom_field_flag: 0
idr_pic_id: 0
pic_order_cnt_lsb: 0
Nal is part of last picture
Nal length 14525 start code 4 bytes
ref 3 type 5 Coded slice of an IDR picture
first_mb_in_slice: 1320
slice_type: 2 (I)
pic_parameter_set_id: 0
frame_num: 0 (12 bits)
field_pic_flag: 1
bottom_field_flag: 0
idr_pic_id: 0
pic_order_cnt_lsb: 0
Nal is part of last picture
Nal length 12591 start code 4 bytes
ref 3 type 5 Coded slice of an IDR picture
first_mb_in_slice: 2040
slice_type: 2 (I)
pic_parameter_set_id: 0
frame_num: 0 (12 bits)
field_pic_flag: 1
bottom_field_flag: 0
idr_pic_id: 0
pic_order_cnt_lsb: 0
Nal is part of last picture
Nal length 20314 start code 4 bytes
ref 3 type 5 Coded slice of an IDR picture
first_mb_in_slice: 2640
slice_type: 2 (I)
pic_parameter_set_id: 0
frame_num: 0 (12 bits)
field_pic_flag: 1
bottom_field_flag: 0
idr_pic_id: 0
pic_order_cnt_lsb: 0
Nal is part of last picture
Nal length 8449 start code 4 bytes
ref 3 type 5 Coded slice of an IDR picture
first_mb_in_slice: 3360
slice_type: 2 (I)
pic_parameter_set_id: 0
frame_num: 0 (12 bits)
field_pic_flag: 1
bottom_field_flag: 0
idr_pic_id: 0
pic_order_cnt_lsb: 0
Nal is part of last picture
Nal length 6 start code 4 bytes
ref 0 type 9 Access unit delimeter
primary_pic_type: 0
Nal length 29 start code 4 bytes
ref 3 type 7 Sequence parameter set
profile: 77
constaint_set0_flag: 0
constaint_set1_flag: 1
constaint_set2_flag: 0
constaint_set3_flag: 0
level_idc: 40
seq parameter set id: 0
log2_max_frame_num_minus4: 8
pic_order_cnt_type: 0
log2_max_pic_order_cnt_lsb_minus4: 5
num_ref_frames: 2
gaps_in_frame_num_value_allowed_flag: 0
pic_width_in_mbs_minus1: 119 (1920)
pic_height_in_map_minus1: 33
frame_mbs_only_flag: 0
derived height: 1088
mb_adaptive_frame_field_flag: 0
direct_8x8_inference_flag: 1
frame_cropping_flag: 0
vui_parameters_present_flag: 1
aspect_ratio_info_present_flag: 1
aspect_ratio_idc:1
overscan_info_present_flag: 1
overscan_appropriate_flag: 1
video_signal_info_present_flag: 1
video_format: 5
video_full_range_flag: 1
colour_description_present_flag: 1
colour_primaries: 1
transfer_characteristics: 1
matrix_coefficients: 1
chroma_loc_info_present_flag: 1
chroma_sample_loc_type_top_field: 0
chroma_sample_loc_type_bottom_field: 0
timing_info_present_flag: 1
num_units_in_tick: 1
time_scale: 50
fixed_frame_scale: 1
nal_hrd_parameters_present_flag: 0
vcl_hrd_parameters_present_flag: 0
pic_struct_present_flag: 0
Nal length 8 start code 4 bytes
ref 3 type 8 Picture parameter set
pic_parameter_set_id: 0
seq_parameter_set_id: 0
entropy_coding_mode_flag: 1
pic_order_present_flag: 0
num_slice_groups_minus1: 0
num_ref_idx_l0_active_minus1: 1
num_ref_idx_l1_active_minus1: 0
weighted_pred_flag: 0
weighted_bipred_idc: 0
pic_init_qp_minus26: 0
pic_init_qs_minus26: 0
chroma_qp_index_offset: 0
deblocking_filter_control_present_flag: 1
constrained_intra_pred_flag: 0
redundant_pic_cnt_present_flag: 0
Nal length 2213 start code 4 bytes
ref 3 type 1 Coded slice of non-IDR picture
first_mb_in_slice: 0
slice_type: 2 (I)
pic_parameter_set_id: 0
frame_num: 0 (12 bits)
field_pic_flag: 1
bottom_field_flag: 1
pic_order_cnt_lsb: 1
Nal length 11536 start code 4 bytes
ref 3 type 1 Coded slice of non-IDR picture
first_mb_in_slice: 600
slice_type: 2 (I)
pic_parameter_set_id: 0
frame_num: 0 (12 bits)
field_pic_flag: 1
bottom_field_flag: 1
pic_order_cnt_lsb: 1
Nal is part of last picture
Nal length 14494 start code 4 bytes
ref 3 type 1 Coded slice of non-IDR picture
first_mb_in_slice: 1320
slice_type: 2 (I)
pic_parameter_set_id: 0
frame_num: 0 (12 bits)
field_pic_flag: 1
bottom_field_flag: 1
pic_order_cnt_lsb: 1
Nal is part of last picture
Nal length 12596 start code 4 bytes
ref 3 type 1 Coded slice of non-IDR picture
first_mb_in_slice: 2040
slice_type: 2 (I)
pic_parameter_set_id: 0
frame_num: 0 (12 bits)
field_pic_flag: 1
bottom_field_flag: 1
pic_order_cnt_lsb: 1
Nal is part of last picture
Nal length 20204 start code 4 bytes
ref 3 type 1 Coded slice of non-IDR picture
first_mb_in_slice: 2640
slice_type: 2 (I)
pic_parameter_set_id: 0
frame_num: 0 (12 bits)
field_pic_flag: 1
bottom_field_flag: 1
pic_order_cnt_lsb: 1
Nal is part of last picture
Nal length 8355 start code 4 bytes
ref 3 type 1 Coded slice of non-IDR picture
first_mb_in_slice: 3360
slice_type: 2 (I)
pic_parameter_set_id: 0
frame_num: 0 (12 bits)
field_pic_flag: 1
bottom_field_flag: 1
pic_order_cnt_lsb: 1
Nal is part of last picture
Nal length 6 start code 4 bytes
ref 0 type 9 Access unit delimeter
primary_pic_type: 1
Nal length 1043 start code 4 bytes
ref 3 type 1 Coded slice of non-IDR picture
first_mb_in_slice: 0
slice_type: 0 (P)
pic_parameter_set_id: 0
frame_num: 1 (12 bits)
field_pic_flag: 1
bottom_field_flag: 0
pic_order_cnt_lsb: 2
Nal length 5027 start code 4 bytes
ref 3 type 1 Coded slice of non-IDR picture
first_mb_in_slice: 600
slice_type: 0 (P)
pic_parameter_set_id: 0
frame_num: 1 (12 bits)
field_pic_flag: 1
bottom_field_flag: 0
pic_order_cnt_lsb: 2
Nal is part of last picture
Nal length 6266 start code 4 bytes
ref 3 type 1 Coded slice of non-IDR picture
first_mb_in_slice: 1320
slice_type: 0 (P)
pic_parameter_set_id: 0
frame_num: 1 (12 bits)
field_pic_flag: 1
bottom_field_flag: 0
pic_order_cnt_lsb: 2
Nal is part of last picture
Nal length 5114 start code 4 bytes
ref 3 type 1 Coded slice of non-IDR picture
first_mb_in_slice: 2040
slice_type: 0 (P)
pic_parameter_set_id: 0
frame_num: 1 (12 bits)
field_pic_flag: 1
bottom_field_flag: 0
pic_order_cnt_lsb: 2
Nal is part of last picture
Nal length 7012 start code 4 bytes
ref 3 type 1 Coded slice of non-IDR picture
first_mb_in_slice: 2640
slice_type: 0 (P)
pic_parameter_set_id: 0
frame_num: 1 (12 bits)
field_pic_flag: 1
bottom_field_flag: 0
pic_order_cnt_lsb: 2
Nal is part of last picture
Nal length 2817 start code 4 bytes
ref 3 type 1 Coded slice of non-IDR picture
first_mb_in_slice: 3360
slice_type: 0 (P)
pic_parameter_set_id: 0
frame_num: 1 (12 bits)
field_pic_flag: 1
bottom_field_flag: 0
pic_order_cnt_lsb: 2
Nal is part of last picture
Nal length 6 start code 4 bytes
ref 0 type 9 Access unit delimeter
primary_pic_type: 1
Nal length 768 start code 4 bytes
ref 3 type 1 Coded slice of non-IDR picture
first_mb_in_slice: 0
slice_type: 0 (P)
pic_parameter_set_id: 0
frame_num: 1 (12 bits)
field_pic_flag: 1
bottom_field_flag: 1
pic_order_cnt_lsb: 3
Nal length 3357 start code 4 bytes
ref 3 type 1 Coded slice of non-IDR picture
first_mb_in_slice: 600
slice_type: 0 (P)
pic_parameter_set_id: 0
frame_num: 1 (12 bits)
field_pic_flag: 1
bottom_field_flag: 1
pic_order_cnt_lsb: 3
Nal is part of last picture
Nal length 4498 start code 4 bytes
ref 3 type 1 Coded slice of non-IDR picture
first_mb_in_slice: 1320
slice_type: 0 (P)
pic_parameter_set_id: 0
frame_num: 1 (12 bits)
field_pic_flag: 1
bottom_field_flag: 1
pic_order_cnt_lsb: 3
Nal is part of last picture
Nal length 3533 start code 4 bytes
ref 3 type 1 Coded slice of non-IDR picture
first_mb_in_slice: 2040
slice_type: 0 (P)
pic_parameter_set_id: 0
frame_num: 1 (12 bits)
field_pic_flag: 1
bottom_field_flag: 1
pic_order_cnt_lsb: 3
Nal is part of last picture
Nal length 4931 start code 4 bytes
ref 3 type 1 Coded slice of non-IDR picture
first_mb_in_slice: 2640
slice_type: 0 (P)
pic_parameter_set_id: 0
frame_num: 1 (12 bits)
field_pic_flag: 1
bottom_field_flag: 1
pic_order_cnt_lsb: 3
Nal is part of last picture
Nal length 2370 start code 4 bytes
ref 3 type 1 Coded slice of non-IDR picture
first_mb_in_slice: 3360
slice_type: 0 (P)
pic_parameter_set_id: 0
frame_num: 1 (12 bits)
field_pic_flag: 1
bottom_field_flag: 1
pic_order_cnt_lsb: 3
Nal is part of last picture

bond
23rd August 2006, 19:25
"Nal is part of last picture" tells you that the listed slice is part of the last picture