I get corrpted output h264 file while saving the output file

below is the linking .!!
.
.
.
.

data.codeparser = gst_element_factory_make ("h264parse", "h264-parser1");

    //    data.encoder = gst_element_factory_make ("nvv4l2h264enc", "h264-enc");

        data.sink = gst_element_factory_make ("filesink", "file-sink");

    g_object_set (G_OBJECT (data.sink), "location", "./out.h264", NULL);

    g_object_set (G_OBJECT (data.sink), "sync", 0, NULL);
gst_element_link(data.queue, data.nvvidconv_pre);

    gst_element_link(data.nvvidconv_pre, data.nvosd);

    gst_element_link(data.nvosd, data.nvvidconv);

    gst_element_link(data.nvvidconv, data.caps);

    gst_element_link(data.caps, data.encoder);

    gst_element_link(data.encoder, data.codeparser);

    gst_element_link(data.codeparser, data.container);

    gst_element_link(data.container, data.sink);

Please provide the following information when requesting support.

• Hardware (T4/V100/Xavier/Nano/etc) - T4
• Network Type (Detectnet_v2/Faster_rcnn/Yolo_v4/LPRnet/Mask_rcnn/Classification/etc)
• TLT Version (Please run “tlt info --verbose” and share “docker_tag” here)
• Training spec file(If have, please share here)
• How to reproduce the issue ? (This is for errors. Please share the command line and the detailed log here.)

Did you follow GitHub - NVIDIA-AI-IOT/deepstream_tao_apps: Sample apps to demonstrate how to deploy models trained with TAO on DeepStream ?

was able to resolve it . Thank you so much …