This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

dm36x h264 encoding: VUI is not present even when setting up params structure

Hi all,

I have a simple muxing Gstreamer pipe:

gst-launch-1.0 -e v4l2src chain-ipipe=true ! 'video/x-raw, format=(string)NV12, width=640, height=480' ! ce_h264enc headers=true vui-enable=1 ! queue ! qtmux ! filesink location=/tmp/prog_vui4_3.mp4 sync=false async=false

The vui-enable property in the ce gstreamer plugin does the following:

h264_params->enableVUIparams = 1;

Then I perform a recording exercise, extract the h264 from the mp4 and use an h264 bitstream tool to analyze the content:

======= SPS =======
profile_idc : 100
constraint_set0_flag : 0
constraint_set1_flag : 0
constraint_set2_flag : 0
constraint_set3_flag : 0
constraint_set4_flag : 0
constraint_set5_flag : 0
reserved_zero_2bits : 0
level_idc : 40
seq_parameter_set_id : 0
chroma_format_idc : 1
residual_colour_transform_flag : 0
bit_depth_luma_minus8 : 0
bit_depth_chroma_minus8 : 0
qpprime_y_zero_transform_bypass_flag : 0
seq_scaling_matrix_present_flag : 1
log2_max_frame_num_minus4 : 41
pic_order_cnt_type : 4
log2_max_pic_order_cnt_lsb_minus4 : 0
delta_pic_order_always_zero_flag : 0
offset_for_non_ref_pic : 0
offset_for_top_to_bottom_field : 0
num_ref_frames_in_pic_order_cnt_cycle : 0
num_ref_frames : 2
gaps_in_frame_num_value_allowed_flag : 0
pic_width_in_mbs_minus1 : 4
pic_height_in_map_units_minus1 : 2
frame_mbs_only_flag : 1
mb_adaptive_frame_field_flag : 0
direct_8x8_inference_flag : 0
frame_cropping_flag : 0
frame_crop_left_offset : 0
frame_crop_right_offset : 0
frame_crop_top_offset : 0
frame_crop_bottom_offset : 0
vui_parameters_present_flag : 0
=== VUI ===
aspect_ratio_info_present_flag : 0
aspect_ratio_idc : 0
sar_width : 0
sar_height : 0
overscan_info_present_flag : 0
overscan_appropriate_flag : 0
video_signal_type_present_flag : 0
video_format : 0
video_full_range_flag : 0
colour_description_present_flag : 0
colour_primaries : 0
transfer_characteristics : 0
matrix_coefficients : 0
chroma_loc_info_present_flag : 0
chroma_sample_loc_type_top_field : 0
chroma_sample_loc_type_bottom_field : 0
timing_info_present_flag : 0
num_units_in_tick : 0
time_scale : 0
fixed_frame_rate_flag : 0
nal_hrd_parameters_present_flag : 0
vcl_hrd_parameters_present_flag : 0
low_delay_hrd_flag : 0
pic_struct_present_flag : 0
bitstream_restriction_flag : 0
motion_vectors_over_pic_boundaries_flag : 0
max_bytes_per_pic_denom : 0
max_bits_per_mb_denom : 0
log2_max_mv_length_horizontal : 0
log2_max_mv_length_vertical : 0
num_reorder_frames : 0
max_dec_frame_buffering : 0

There are no sights of the VUI, I have been following the h264 encoder dm365 user guide (SPRUEU9B) and the dm36x h264x encoder FAQ but still there is no VUI in my output.

Am I missing some configuration or any other step ??, here is my hw/sw setup:

Board: LeopardBoard dm368

Kernel: Linux dm365 2.6.32-1

dvsdk-4_02_00_06/codec-engine_2_26_02_11

dvsdk-4_02_00_06/codecs-dm365_4_02_00_00

gst-ce-plugins v1.0.5

Thanks

- JoseLopez

  • Hi,

    Can you please check whether you are using base-class or extended class param, for this please h264_params.size, it should be sizeof(IH264VENC_Params). 

    Please share all parameters and generated bitstream.

    Thanks,

    Veeranna

  • 2476.prog_vui4_11_bitstream.txt

    Hello Veeranna,

    I attached a document with the complete bitstream analysis, you can open it with any text editor. About the params, here is an snippet of the gstreamer plugin init function:

    GstCeVidEnc *ce_videnc = GST_CEVIDENC (h264enc);
    IH264VENC_Params *h264_params = NULL;
    IH264VENC_DynamicParams *h264_dyn_params = NULL;

    GST_DEBUG_OBJECT (h264enc, "setup H.264 parameters");
    /* Alloc the params and set a default value */
    h264_params = g_malloc0 (sizeof (IH264VENC_Params));
    if (!h264_params)
    goto fail_alloc;
    *h264_params = IH264VENC_PARAMS;

    h264_dyn_params = g_malloc0 (sizeof (IH264VENC_DynamicParams));
    if (!h264_dyn_params)
    goto fail_alloc;
    *h264_dyn_params = H264VENC_TI_IH264VENC_DYNAMICPARAMS;

    if (ce_videnc->codec_params) {
    GST_DEBUG_OBJECT (h264enc, "codec params not NULL, copy and free them");
    h264_params->videncParams = *ce_videnc->codec_params;
    g_free (ce_videnc->codec_params);
    }
    ce_videnc->codec_params = (VIDENC1_Params *) h264_params;

    if (ce_videnc->codec_dyn_params) {
    GST_DEBUG_OBJECT (h264enc,
    "codec dynamic params not NULL, copy and free them");
    h264_dyn_params->videncDynamicParams = *ce_videnc->codec_dyn_params;
    g_free (ce_videnc->codec_dyn_params);
    }
    ce_videnc->codec_dyn_params = (VIDENC1_DynamicParams *) h264_dyn_params;

    /* Add the extends params to the original params */
    ce_videnc->codec_params->size = sizeof (IH264VENC_Params);
    ce_videnc->codec_dyn_params->size = sizeof (IH264VENC_DynamicParams);

    Regards

    - JoseLopez

  • Veeranna,

    Seems that the sequence scaling matrix property was a requirement for the VUI to show up:

    gst-launch-1.0 -e v4l2src chain-ipipe=true ! 'video/x-raw, format=(string)NV12, width=640, height=480' ! ce_h264enc seqscaling=0 vui-enable=1 ! queue ! qtmux ! filesink location=/tmp/inter_vui1_00.mp4 sync=false async=false

    vui_parameters_present_flag : 1
    === VUI ===
    aspect_ratio_info_present_flag : 1
    aspect_ratio_idc : 1
    sar_width : 0
    sar_height : 0
    overscan_info_present_flag : 0
    overscan_appropriate_flag : 0
    video_signal_type_present_flag : 1
    video_format : 2
    video_full_range_flag : 1
    colour_description_present_flag : 0
    colour_primaries : 0
    transfer_characteristics : 0
    matrix_coefficients : 0
    chroma_loc_info_present_flag : 0
    chroma_sample_loc_type_top_field : 0
    chroma_sample_loc_type_bottom_field : 0
    timing_info_present_flag : 1
    num_units_in_tick : 2
    time_scale : 60
    fixed_frame_rate_flag : 0
    nal_hrd_parameters_present_flag : 1
    vcl_hrd_parameters_present_flag : 0
    low_delay_hrd_flag : 1
    pic_struct_present_flag : 0
    bitstream_restriction_flag : 1
    motion_vectors_over_pic_boundaries_flag : 1
    max_bytes_per_pic_denom : 0
    max_bits_per_mb_denom : 0
    log2_max_mv_length_horizontal : 16
    log2_max_mv_length_vertical : 16
    num_reorder_frames : 0
    max_dec_frame_buffering : 2

     

    Regards