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.

Omap4 gstreamer omx_h264enc paramter regulate

Hi everyone !

    Now  i do the video encode on the omap4 and android ,use the  gstreamer. the encoder can encode the yuv file now .I want to change the paramter of the codec  when it is running.i want to know  the gstreamer/gst-openmax   whether or not  can support this function  and where i can find  the message or example .  Thank you very much!

 

                                                                                         

  • Aaron,

    I have understood that you have integrated Gstreamer on Android. Is this correct?

    Can you be more specific what are the parameters you want to change on gstreamer/gst-openmax pipeline?

    Regards,

    Chintan

  • Chintan:

    Yes,you are right.I want to know some parameters of omx_h264enc/omx_h264dec on the gstreamer/gst-openmax.

    Such as the bitrate of the omx_h264enc.I want to change the bitrate when the encode is running  becase the   bandwidth of network changed.

    Regards

    Aaron.

  • Aaron,

    There are several parameters you can control using omx_h264enc/omx_h264dec. The parameters like bitrate, profile, level etc.

    Type the following commands it will list out all the parameters supported.

    #gst-inspect omx_h264enc

    #gst-inspect omx_h264dec

    Regards,

    Chintan

  • Hi  Chintan:

                I know the command "gst-inspect". I have try to change the bitrate when the encode running .  from the message printed by omc_h264enc,the bitrate did not changed as i want.the code like this:

    /*
    gst-launch filesrc location=/mnt/extsd/nv12.yuv  ! videoparse width=1280 height=720 framerate=22/1 ! omx_h264enc bitrate=1024000 ! avimux ! filesink location=/mnt/sdcard/nv12.avi
    */
    int myvideotest(int argc,char **argv)
    {
     GMainLoop *loop;
     GstElement *filesrc,*videoparse,*avimux,*sink;
     GstBus *bus;
     GstCaps *caps = NULL;
     GstPad *pad;
     gboolean res;
     int i;
     gint bit=0;
     long count = 0;
     gst_init(&argc,&argv);

     loop = g_main_loop_new(NULL,FALSE);
     pipeline = gst_pipeline_new(NULL);
       
     bus = gst_pipeline_get_bus(GST_PIPELINE(pipeline));
     gst_bus_add_watch(bus,bus_call,loop);
     gst_object_unref(bus);

     filesrc = gst_element_factory_make("filesrc","disk_source");
     g_object_set(G_OBJECT(filesrc),"location","/mnt/extsd/nv12.yuv",NULL);
     videoparse = gst_element_factory_make("videoparse","parse");
     g_object_set(G_OBJECT(videoparse),"width",1280,NULL);
     g_object_set(G_OBJECT(videoparse),"height",720,NULL);
     g_object_set(G_OBJECT(videoparse),"framerate","22",NULL);

     encode = gst_element_factory_make("omx_h264enc", "encode");
     g_object_set(G_OBJECT(encode),"bitrate",1024*100,NULL);
     g_object_set(G_OBJECT(encode),"profile",8,NULL);
     avimux = gst_element_factory_make("avimux","mux");
     sink = gst_element_factory_make("filesink", "sink");
     g_object_set(G_OBJECT(sink),"location","/mnt/sdcard/nv12.avi",NULL);
     
     g_object_get(G_OBJECT(encode),"bitrate",&bit,NULL);
     android_printf(3,"before bit = %d\n",bit);
     bit = 100;
     
     gst_bin_add_many(GST_BIN(pipeline),filesrc,videoparse,encode,avimux,sink,NULL);
     gst_element_link_many(filesrc,videoparse,encode,avimux,sink,NULL);
     gst_element_set_state(pipeline,GST_STATE_PLAYING);
     while(count < 100000000)
     {
      count++;
     }
     android_printf(3,"##################### count=%ld\n",count);
     gst_element_set_state(encode,GST_STATE_NULL);
     g_object_set(G_OBJECT(encode),"bitrate",200,NULL);
     gst_element_set_state(encode,GST_STATE_PLAYING);
     g_object_get(G_OBJECT(encode),"bitrate",&bit,NULL);
     android_printf(3,"======================after set bit = %d\n",bit);
     g_main_loop_run(loop);

     gst_element_set_state(pipeline,GST_STATE_NULL);
     gst_object_unref(GST_OBJECT(pipeline));
     return 0;
    }

     Regards,

    Aaron

  • Aaron, Thanks for the clarification.

    I have noticed that you are changing bit-rate on-the-fly from 1024*100 bps  to just 200 bps. I think 200 bps it too low and may not be supported under the level & profile you have selected. Please try at least 1000*100 or 512*100 and see if it changes.

    Meanwhile I will cross check it on-the-fly bit-rate is supported by the encoder.

    Regards,

    Chintan

  • Aaron,

    I have confirmed that the bit-rate of omx_h264enc can be changed on-the-fly. The encoder component does not have such restriction.

    Regards,

    Chintan

  •  Chintan,

     I am sorry for late. I have do this check and change the bitrate of omx_h264enc from  102400 to 80000. I found the bitrate has transformed into  800000  by  "g_object_get(G_OBJECT(encode),"bitrate",&bit,NULL);" .but  the program was stop after i changed.The information is show to me.

    [74006.926269] omap mailbox rev 0.0
    [74006.970062] omap_hwmod: ipu: failed to reset in 10000 usec
    [74006.976593] omap-iommu omap-iommu.0: ducati: version 2.1
    [74006.982727] Wakeup SYSM3
    [74006.986541] Wakeup APPM3
    [74007.025573] omap-remoteproc omap-remoteproc.0: omap_rproc_open: dev num 0, name tesla, count 2
    [74007.035186] omap-remoteproc omap-remoteproc.1: omap_rproc_open: dev num 1, name ducati-proc0, count 2
    [74007.045837] omap-remoteproc omap-remoteproc.2: omap_rproc_open: dev num 2, name ducati-proc1, count 2
    [74007.058319] omap-remoteproc omap-remoteproc.0: omap_rproc_open: dev num 0, name tesla, count 2
    [74007.068115] omap-remoteproc omap-remoteproc.1: omap_rproc_open: dev num 1, name ducati-proc0, count 2
    [74007.078552] omap-remoteproc omap-remoteproc.2: omap_rproc_open: dev num 2, name ducati-proc1, count 2
    [74007.089752] proc4430_attach num_mem_entries = 6
    [74007.094879] proc_mgr_attach:proc_mgr_handle->num_mem_entries = 0
    [74007.102172] proc4430_attach num_mem_entries = 6
    [74007.107330] proc_mgr_attach:proc_mgr_handle->num_mem_entries = 0
    [74007.114685] omap-remoteproc omap-remoteproc.2: omap_rproc_ioctl
    [74007.122253] omap-remoteproc omap-remoteproc.2: omap_rproc_ioctl
    [74007.129821] nameserver_get_local entry not found!
    [74007.138214] Registered user-space process for DEV_SYS_ERROR event in AppM3
    [74007.145935] omap-remoteproc omap-remoteproc.2: omap_rproc_ioctl
    [74007.152832] Registered user-space process for DEV_WATCHDOG_ERROR event in AppM3
    hardware/ti/omx/ducati/domx/system/domx/omx_proxy_common/src/omx_proxy_common.c:1331    PROXY_GetParameter()    ERROR: Returning error, eError = 0x80001005
    hardware/ti/omx/ducati/domx/system/domx/omx_proxy_common/[74007.193267] messageq_get failed! status = 0xffffffec
    src/omx_proxy_co[74007.199371] omap-remoteproc omap-remoteproc.2: omap_rproc_ioctl
    mmon.c:1331    PROXY_GetParameter()    ERROR: Returning error, eError = 0x80001005
    [74007.225921] omap-remoteproc omap-remoteproc.0: omap_rproc_open: dev num 0, name tesla, count 2
    [74007.235260] omap-remoteproc omap-remoteproc.1: omap_rproc_open: dev num 1, name ducati-proc0, count 2
    [74007.245483] omap-remoteproc omap-remoteproc.2: omap_rproc_open: dev num 2, name ducati-proc1, count 2
    [74007.256652] omap-remoteproc omap-remoteproc.0: omap_rproc_open: dev num 0, name tesla, count 2
    [74007.265838] omap-remoteproc omap-remoteproc.1: omap_rproc_open: dev num 1, name ducati-proc0, count 2
    [74007.275573] omap-remoteproc omap-remoteproc.2: omap_rproc_open: dev num 2, name ducati-proc1, count 2
    [74007.285736] proc4430_attach num_mem_entries = 6
    [74007.290466] proc_mgr_attach:proc_mgr_handle->num_mem_entries = 0
    [74007.297149] proc4430_attach num_mem_entries = 6
    [74007.301879] proc_mgr_attach:proc_mgr_handle->num_mem_entries = 0
    [74007.308746] omap-remoteproc omap-remoteproc.2: omap_rproc_ioctl
    [74007.315155] omap-remoteproc omap-remoteproc.2: omap_rproc_ioctl
    [74007.322235] nameserver_get_local entry not found!
    [74007.328857] Registered user-space process for DEV_SYS_ERROR event in AppM3
    [74007.336151] omap-remoteproc omap-remoteproc.2: omap_rproc_ioctl
    [74007.342498] Registered user-space process for DEV_WATCHDOG_ERROR event in AppM3
    [74012.375274] Sleep APPM3
    [74012.378601] Sleep SYSM3

    the nv12.avi was created by program and the size of it is zero bit all the time.
    so Can i know the check code that you use?Thank you!

    Regards,

    Aaron.

  • Aaron,

    I have not checked this on GStreamer as such. But I have confirmed that the OMX encoder component is capable of supporting on-the-fly bitrate change.

    Normally we program video bitrate at the initialization of video encoder component using OMX_setParameter() call. Once OMX component is in executing state you can not call this function as per OMX standard. I think this is what is happening in your case. The GStreamer is trying to call OMX_setParameter() during execution state and this generates an error.

    There is way that you can use OMX_SetConfig() during the execution time.  I suggest that if possible modify the GST component to make use of this feature. TI OMX components support dynamic video bitrate configuration by using OMX_SetConfig() with index OMX_IndexConfigVideoBitrate. This is the only option you have are left with if you have absolute critical requirement of changing bitrate the on-the-fly.

    Please let me know if required further clarification on this.

    Regards,

    Chintan

  • Hi Chintan,

    Is there any Prebuilt OMX Encode/Decode Sample APk's are available for OMAP 4 series with Android 4.0.3?

    Regards,

    Archana

  • Archana:

        The stagefright uses openmax  wraped  but  no apk uses  the gst-openmax.

    Regards

    Aaron

  • Archana,

    Can you let us which release you are using? As of now the StageFright is using OpenMax codecs in Android.

    Regards,

    Chintan