Problem with gstreamer appsrc to omxh264enc

My requirement is generate h264 mp4 video from I420 raw data,
I have tested this pipline and it can work,

gst-launch-1.0 multifilesrc location=%04d.yuv ! videoparse format=2 
width=3392 height=2008 framerate=25/1 ! videoconvert ! videorate ! omxh264enc ! 
mp4mux ! filesink location=out.mp4

But it dose not work,when I use appsrc to replace the multifilesrc in my gst-app.

luanch_src << "appsrc  ! videoparse format=2 width=3392 height=2008 
framerate=25/1 ! videoconvert ! videorate ! omxh264enc ! mp4mux ! filesink 
location=out.mp4";

In my gst-app,I get data by “pull-sample” from appsink,then pass data to appsrc by “push buffer”

static GstFlowReturn new_sample (GstElement *sink, CustomData *data) { 
  GstSample *sample; 
  /* Retrieve the buffer */ 
  g_signal_emit_by_name (sink, "pull-sample", &sample); 
  if (sample) { 

    GstBuffer *buffer_sink = gst_sample_get_buffer(sample); 
    GstMemory *memory = gst_buffer_get_memory(buffer_sink, 0); 
    GstMapInfo info; 
    gst_memory_map(memory, &info, GST_MAP_READ); 


    if (data->sample_num >= 150) 
    { 
        GstBuffer *buffer_src = gst_buffer_copy_deep(buffer_sink); 
        GST_BUFFER_PTS(buffer_src) = gst_util_uint64_scale (data->sample_num - 150, GST_SECOND, 25); 
        GST_BUFFER_TIMESTAMP (buffer_src) = gst_util_uint64_scale (data->sample_num - 150, GST_SECOND, 25); 
        GST_BUFFER_DURATION (buffer_src) = gst_util_uint64_scale (1, GST_SECOND, 25); 

        gst_app_src_push_buffer((GstAppSrc*)data->app_src, buffer_src); 
    } 

    gst_memory_unmap(memory, &info); 
    gst_memory_unref(memory); 
    gst_sample_unref (sample); 

    data->sample_num++; 
    return GST_FLOW_OK; 
  }

Although I read the gstreamer doc, I still found no problems.
Is there somethin wrong with me?
Any ideas? Thanks!

Hi,
Please check samples at below posts:
https://devtalk.nvidia.com/default/topic/1026106/jetson-tx1/encode-opencv-output-frame-buffers-using-gstreamer-appsrc/post/5219225/#5219225
https://devtalk.nvidia.com/default/topic/1031734/jetson-tx2/appsrc-link-to-nvvidconv-error-with-reason-not-negotiated-4-/post/5250184/#5250184
https://devtalk.nvidia.com/default/topic/1015571/jetson-tx2/what-is-maximum-video-encoding-resolution-in-pixels-/post/5253760/#5253760