omxh264 can't control bitrate

1.I use the flow code:


int main(int argc, char * argv)
GstElement *pipeline;
GstElement *source, *filter,*queue, *vcon, *encoder, *h264parse, *mux, *sink;
GstCaps caps;
Initialize GStreamer */
gst_init(&argc, &argv);

/* Build Pipeline */
pipeline = gst_pipeline_new("bitrate");

//creating_pipeline(ip_address, port);

source    = gst_element_factory_make ( "videotestsrc", "source");
filter    = gst_element_factory_make ( "capsfilter", "filter");
queue     = gst_element_factory_make ( "queue", "queue");
vcon      = gst_element_factory_make ( "videoconvert", "videoconvert");
encoder   = gst_element_factory_make ( "omxh264enc", "video_encoder");
h264parse = gst_element_factory_make ( "h264parse",    "parse");
mux       = gst_element_factory_make ( "avimux", "muxer");
sink 	  = gst_element_factory_make ( "filesink", "sink");

/* Configure the filter */
caps = gst_caps_from_string("video/x-raw,width=1920,height=1080,framerate=30/1");
g_object_set (G_OBJECT (filter), "caps", caps, NULL);

gst_bin_add_many (GST_BIN (pipeline),source,filter,queue, vcon,encoder, h264parse, mux, sink,NULL);
gst_element_link_many(source,filter,queue, vcon,encoder, h264parse, mux, sink,NULL);

g_object_set (G_OBJECT (sink), "location", "bitrate_1080p_2000000_ctl.avi", NULL);
g_object_set (G_OBJECT (encoder), "control-rate",2,NULL);
g_object_set (G_OBJECT (encoder), "bitrate", 2000000, NULL);
g_object_set (G_OBJECT (encoder), "qp-range","35,51:35,51:-1,-1", NULL);

gst_element_set_state (pipeline, GST_STATE_PLAYING);

GstBus* bus = gst_element_get_bus(pipeline);
GstMessage* msg = gst_bus_timed_pop_filtered (bus, GST_CLOCK_TIME_NONE, (GstMessageType)(GST_MESSAGE_ERROR | GST_MESSAGE_EOS));
if (msg != NULL)
gst_object_unref (bus);

gst_element_set_state(pipeline, GST_STATE_NULL);

return 0;


2.Run 20 seconds, the file is 22.6M, so the stream is 8Mbit/s

3.We I use ffmpeg -i bitrate_1080p_1000000_ctl.avi
Input #0, avi, from ‘bitrate_1080p_1000000_ctl.avi’:
Duration: N/A, start: 0.000000, bitrate: N/A
Stream #0:0: Video: h264 (Constrained Baseline) (H264 / 0x34363248), yuv420p(progressive), 1920x1080, 30 fps, 30 tbr, 30 tbn, 60 tbc

It can’t show bitrate, why?
How to control bitrate ?

Please not duplicate one issue into multiple topics. Let’s continue in