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.

AM572x IVA-HD issue

Other Parts Discussed in Thread: AM5728

hello everybody:

I met some problems when I used IVA-HD's AM5728 module:

Here are my steps:

1. AM5728 connected to the keyboard, CTRL+BACKSPACE, CTRL+F2

2. gst-launch-1.0 filesrc location=/usr/share/ti/video/TearOfSteel-Short-1920x800.mov ! qtdemux name=demux demux.audio_0 ! queue ! decodebin ! fakesink demux.video_0 ! queue ! h264parse ! ducatih264dec ! kmssink scale=true

This command can be executed smoothly, you can see the board screen in the play video,

However,when I convert this command to the C language, the program can run, but the screen does not have a picture, the following is my code:

#include <stdio.h>
#include <string.h>
#include <gst/gst.h>
#include <glib.h>

GstElement *pipeline,*source,*demuxer,
      *Videoqueue,*h264par,*Videodecoder,*Videosink,
      *Audioqueue,*Audiodecoder,*Audiosink;

static gboolean bus_call(GstBus *bus,GstMessage *msg,gpointer data){
  GMainLoop *loop = (GMainLoop *)data;

  switch(GST_MESSAGE_TYPE(msg)){

  case GST_MESSAGE_EOS:
  
  g_print("play ending!\n"); 
    break;
  case GST_MESSAGE_ERROR: {
      gchar    *debug;
      GError   *error;
      gst_message_parse_error(msg,&error,&debug);
      g_free(debug);
      g_printerr("Error: %s\n",error->message);
      g_error_free(error);
      g_main_loop_quit(loop);
      break;
  }
  default:
      break;
  }
  return(TRUE);
}

static void on_pad_added(GstElement *element,GstPad *pad,gpointer data){

  char video[12]="video_0"; //char audio[9]="audio_00";
  
  gchar *new_pad_name = GST_PAD_NAME(pad);
  
  g_print("recvfrom '%s' new pad' %s' \n",GST_ELEMENT_NAME (element),
          new_pad_name);
  
  GstPad *audio_sink_pad ,*video_sink_pad;
  video_sink_pad = gst_element_get_static_pad(Videoqueue,"sink");
  audio_sink_pad = gst_element_get_static_pad(Audioqueue,"sink");
  
  if(!strcmp(new_pad_name,video)){
      g_print("link %s pad\n",new_pad_name);
      gst_pad_link(pad,video_sink_pad);
  }else{
      g_print("link %s pad\n",new_pad_name);
      gst_pad_link(pad,audio_sink_pad);
  }
  
  gst_object_unref(video_sink_pad);
  gst_object_unref(audio_sink_pad);
}


int main(int argc,char *argv[]){
  
  GMainLoop *loop;
  GstBus *bus;
  gst_init(&argc,&argv);
  loop = g_main_loop_new(NULL,FALSE);
  
  if (argc != 2)
  {
      g_printerr("You need file : %s <.moc filename>\n",argv[0]);
      return(-1);
  }
  
  //creating pipeline
  pipeline = gst_pipeline_new("test-pipeline");
  if (!pipeline){
          g_printerr("pipeline creat failure,quit!\n");
          return(-1);
  }

  //creat filesrc element
  source   = gst_element_factory_make("filesrc","file-source");
  if (!source){
          g_printerr("source creat failure,quit!\n");
          return(-1);
  }

  //qtmuxer 
  demuxer  = gst_element_factory_make("qtdemux","demuxer");
  if (!demuxer){
          g_printerr("demuxer creat failure,quit!\n");
          return(-1);
  }


  Videoqueue = gst_element_factory_make("queue","videoqueue");
  if (!Videoqueue){
          g_printerr("Videoqueue creat failure,quit!\n");
          return(-1);
  }

  //h264parse
  h264par = gst_element_factory_make("h264parse","h264par");

  if (!h264par){
          g_printerr("h264par creat failure,quit!\n");
          return(-1);
  }
  
  //video decode
  Videodecoder  = gst_element_factory_make("ducatih264dec","video-decoder");
  if (!Videodecoder){
          g_printerr("Videodecoder creat failure,quit!\n");
          return(-1);
  }

  //video sink
  Videosink = gst_element_factory_make("kmssink","video-output");
  if (!Videosink){
          g_printerr("Videosink creat failure,quit!\n");
          return(-1);
  }

  
  Audioqueue = gst_element_factory_make("queue","audioqueue");
  if (!Audioqueue){
          g_printerr("Audioqueue creat failure,quit!\n");
          return(-1);
  }

  Audiodecoder = gst_element_factory_make("decodebin","audio-decoder");
  if (!Audiodecoder){
          g_printerr("Audiodecoder creat failure,quit!\n");
          return(-1);
  }
  Audiosink = gst_element_factory_make("fakesink","audio-output");
  if (!Audiosink){
          g_printerr("Audiosink creat failure,quit!\n");
          return(-1);
  }
 
//|| !h264par 
/*
  if (!pipeline || !source || !demuxer || !queue || !decoder
      || !textoverlay  || !sink || !Audioqueue || !Audiodecoder
      || !Audiosink){
          g_printerr("element creat failure,quit!\n");
          return(-1);
  }
  */
  //set source location
  g_object_set(G_OBJECT(source),"location",argv[1],NULL);
  //g_object_set(G_OBJECT(Videosink),"scale",1,NULL);


  //bus
  bus = gst_pipeline_get_bus(GST_PIPELINE(pipeline));
  gst_bus_add_watch(bus,bus_call,loop); //添加消息监视器
  gst_object_unref(bus);
  
  //add_bin
  gst_bin_add_many(GST_BIN(pipeline),
            source,demuxer,Videoqueue,h264par,Videodecoder,Videosink,
            Audioqueue,Audiodecoder,Audiosink,NULL);
          
  //link element
  gst_element_link(source,demuxer);
  gst_element_link_many(Videoqueue,h264par,Videodecoder,Videosink,NULL);
  gst_element_link_many(Audioqueue,Audiodecoder,Audiosink,NULL);
  
  // sink pad
  g_signal_connect(demuxer,"pad-added",G_CALLBACK(on_pad_added),NULL);
  


  //playing
  g_print("start playing %s\n",argv[1]);
  gst_element_set_state(pipeline,GST_STATE_PLAYING);
  g_main_loop_run(loop);
  
  //stop 
  gst_element_set_state(pipeline,GST_STATE_NULL);
  //free
  gst_object_unref(GST_OBJECT(pipeline));
  return(0);
}

Compile: /home/aba/ti-processor-sdk-linux-am57xx-evm-03.00.00.04/linux-devkit/sysroots/x86_64-arago-linux/usr/bin/arm-linux-gnueabihf-gcc -pthread gst_mp4.c -o gst_mp4 -I/home/aba/ti-processor-sdk-linux-am57xx-evm-03.00.00.04/targetNFS/usr/include/gstreamer-1.0/ -I/home/aba/ti-processor-sdk-linux-am57xx-evm-03.00.00.04/targetNFS/usr/include/glib-2.0/ -I/home/aba/ti-processor-sdk-linux-am57xx-evm-03.00.00.04/targetNFS/usr/lib/glib-2.0/include/  -I/home/aba/ti-processor-sdk-linux-am57xx-evm-03.00.00.04/targetNFS/usr/include/glib-2.0/glib/ -L/home/aba/ti-processor-sdk-linux-am57xx-evm-03.00.00.04/targetNFS/usr/lib -L/home/aba/ti-processor-sdk-linux-am57xx-evm-03.00.00.04/targetNFS/lib -lgstreamer-1.0 -lgobject-2.0   -lgmodule-2.0  -lpthread  -lxml2 -lglib-2.0

run: ./gst_mp4 /usr/share/ti/video/TearOfSteel-Short-1920x800.mov

  • Hello,

    What about if you use:
    /etc/init.d/weston stop
    ...
    run the app?

    BR
    Margarita
  • a) ctrl+alt+backspace
    b) alt+F2


    I think there may be a problem with my GStreamer program written. Thank you.
  • Hello,

    Could you try with command in the above post?
    I will take a look into the code.
    Could you add the full debug log ?
    I would also recommend you first to try only the "video branch" after it runs without an issue you could add the "audio branch".

    BR
    Margarita

  • Hello,
    I can use the command
    gst-launch-1.0 filesrc location=/usr/share/ti/video/TearOfSteel-Short-1920x800.mov ! qtdemux name=demux demux.audio_0 ! queue ! decodebin ! fakesink demux.video_0 ! queue ! h264parse ! ducatih264dec ! kmssink
    It's success. But now I want to know How do I use the C language program, the use of the above plug-ins
  • This is the command and log:

    root@am57xx-evm:~# gst-launch-1.0 -v --gst-debug=3 filesrc location=/usr/share/ti/video/TearOfSteel-Short-1920x800.mov ! qtdemux name=demux demux.audio_0 ! queue ! decodebin ! fakesink demux.video_0 ! queue ! h264parse ! ducatih264dec ! kmssink
    Setting pipeline to PAUSED ...
    [ 2343.019014] omap-iommu 55082000.mmu: 55082000.mmu: version 2.1
    Pipeline is PREROLLING ...
    0:00:00.227234759 1204 0x12e400 WARN qtdemux ../../../gst-plugins-good-1.2.3/gst/isomp4/qtdemux_types.c:196:qtdemux_type_get: unknown QuickTime node type frma
    0:00:00.227335450 1204 0x12e400 WARN qtdemux ../../../gst-plugins-good-1.2.3/gst/isomp4/qtdemux_types.c:196:qtdemux_type_get: unknown QuickTime node type chan
    0:00:00.227382949 1204 0x12e400 WARN qtdemux ../../../gst-plugins-good-1.2.3/gst/isomp4/qtdemux_types.c:196:qtdemux_type_get: unknown QuickTime node type

    /GstPipeline:pipeline0/GstQueue:queue0.GstPad:src: caps = audio/mpeg, mpegversion=(int)4, framed=(boolean)true, stream-format=(string)raw, level=(string)2, base-profile=(string)lc, profile=(string)lc, codec_data=(buffer)1210, rate=(int)44100, channels=(int)2
    /GstPipeline:pipeline0/GstDecodeBin:decodebin0.GstGhostPad:sink.GstProxyPad:proxypad0: caps = audio/mpeg, mpegversion=(int)4, framed=(boolean)true, stream-format=(string)raw, level=(string)2, base-profile=(string)lc, profile=(string)lc, codec_data=(buffer)1210, rate=(int)44100, channels=(int)2
    /GstPipeline:pipeline0/GstDecodeBin:decodebin0/GstTypeFindElement:typefind.GstPad:src: caps = audio/mpeg, mpegversion=(int)4, framed=(boolean)true, stream-format=(string)raw, level=(string)2, base-profile=(string)lc, profile=(string)lc, codec_data=(buffer)1210, rate=(int)44100, channels=(int)2
    /GstPipeline:pipeline0/GstQueue:queue0.GstPad:sink: caps = audio/mpeg, mpegversion=(int)4, framed=(boolean)true, stream-format=(string)raw, level=(string)2, base-profile=(string)lc, profile=(string)lc, codec_data=(buffer)1210, rate=(int)44100, channels=(int)2
    /GstPipeline:pipeline0/GstQueue:queue1.GstPad:sink: caps = video/x-h264, stream-format=(string)avc, alignment=(string)au, level=(string)4, profile=(string)high, codec_data=(buffer)01640028ffe1001a67640028acd94078065b011000000300100000030300f183196001000668ebe3cb22c0, width=(int)1920, height=(int)800, framerate=(fraction)24/1, pixel-aspect-ratio=(fraction)1/1
    /GstPipeline:pipeline0/GstQueue:queue1.GstPad:sink: caps = video/x-h264, stream-format=(string)avc, alignment=(string)au, level=(string)4, profile=(string)high, codec_data=(buffer)01640028ffe1001a67640028acd94078065b011000000300100000030300f183196001000668ebe3cb22c0, width=(int)1920, height=(int)800, framerate=(fraction)24/1, pixel-aspect-ratio=(fraction)1/1
    /GstPipeline:pipeline0/GstH264Parse:h264parse0.GstPad:sink: caps = video/x-h264, stream-format=(string)avc, alignment=(string)au, level=(string)4, profile=(string)high, codec_data=(buffer)01640028ffe1001a67640028acd94078065b011000000300100000030300f183196001000668ebe3cb22c0, width=(int)1920, height=(int)800, framerate=(fraction)24/1, pixel-aspect-ratio=(fraction)1/1
    /GstPipeline:pipeline0/GstH264Parse:h264parse0.GstPad:src: caps = video/x-h264, stream-format=(string)byte-stream, alignment=(string)au, level=(string)4, profile=(string)high, width=(int)1920, height=(int)800, framerate=(fraction)24/1, pixel-aspect-ratio=(fraction)1/1, parsed=(boolean)true
    /GstPipeline:pipeline0/GstDucatiH264Dec:ducatih264dec0.GstPad:src: caps = video/x-raw, format=(string)NV12, width=(int)2048, height=(int)896, framerate=(fraction)24/1, pixel-aspect-ratio=(fraction)1/1
    /GstPipeline:pipeline0/GstKMSSink:kmssink0.GstPad:sink: caps = video/x-raw, format=(string)NV12, width=(int)2048, height=(int)896, framerate=(fraction)24/1, pixel-aspect-ratio=(fraction)1/1
    0:00:00.236413877 1204 0x12e430 WARN ducati gstducatih264dec.c:402:gst_ducati_h264dec_set_sink_caps:<ducatih264dec0> num-reorder-frames not found on caps, calculation from stream parameters gives 6
    0:00:00.236470973 1204 0x12e430 WARN ducati gstducatih264dec.c:410:gst_ducati_h264dec_set_sink_caps:<ducatih264dec0> Using 6 frames for reordering
    /GstPipeline:pipeline0/GstDucatiH264Dec:ducatih264dec0.GstPad:sink: caps = video/x-h264, stream-format=(string)byte-stream, alignment=(string)au, level=(string)4, profile=(string)high, width=(int)1920, height=(int)800, framerate=(fraction)24/1, pixel-aspect-ratio=(fraction)1/1, parsed=(boolean)true
    /GstPipeline:pipeline0/GstDucatiH264Dec:ducatih264dec0.GstPad:sink: caps = video/x-h264, stream-format=(string)byte-stream, alignment=(string)au, level=(string)4, profile=(string)high, width=(int)1920, height=(int)800, framerate=(fraction)24/1, pixel-aspect-ratio=(fraction)1/1, parsed=(boolean)true
    0:00:00.598110854 1204 0x12e430 WARN ducati gstducatividdec.c:562:codec_process:<ducatih264dec0> changing max-ref-frames in caps to 10
    /GstPipeline:pipeline0/GstDucatiH264Dec:ducatih264dec0.GstPad:src: caps = video/x-raw, format=(string)NV12, width=(int)2048, height=(int)896, framerate=(fraction)24/1, pixel-aspect-ratio=(fraction)1/1, max-ref-frames=(int)10
    /GstPipeline:pipeline0/GstKMSSink:kmssink0.GstPad:sink: caps = video/x-raw, format=(string)NV12, width=(int)2048, height=(int)896, framerate=(fraction)24/1, pixel-aspect-ratio=(fraction)1/1, max-ref-frames=(int)10
    Pipeline is PREROLLED ...
    Setting pipeline to PLAYING ...
    New clock: GstSystemClock
    0:00:20.355480668 1204 0x12e490 WARN audiodecoder ../../../../gst-plugins-base-1.2.3/gst-libs/gst/audio/gstaudiodecoder.c:1450:gst_audio_decoder_drain:<faad0> still 1 frames left after draining
    0:00:21.627769539 1204 0x12e430 WARN ducati gstducatividdec.c:542:codec_process:<ducatih264dec0> err=-1, extendedError=00040000
    0:00:21.627827448 1204 0x12e430 ERROR ducati gstducati.c:60:gst_ducati_log_extended_error_info: Bit 18 (00040000): stream end
    Got EOS from element "pipeline0".
    Execution ended after 0:00:20.999224240
    Setting pipeline to PAUSED ...
    Setting pipeline to READY ...
    0:00:21.668795536 1204 0x13cec0 WARN ducati gstducatividdec.c:542:codec_process:<ducatih264dec0> err=-1, extendedError=00040000
    0:00:21.668862880 1204 0x13cec0 ERROR ducati gstducati.c:60:gst_ducati_log_extended_error_info: Bit 18 (00040000): stream end
    Setting pipeline to NULL ...
    Freeing pipeline ...
  • Hello,

    I meant the log when you execute your application not the pipeline itself.

    Are you sure this line is correct:
    g_signal_connect(demuxer,"pad-added",G_CALLBACK(on_pad_added),NULL);
    Is it suppose to be g_signal_connect(demuxer,"pad-added",G_CALLBACK(on_pad_added), Videoqueue);?

    BR
    Margarita
  • root@am57xx-evm:~# ./gst_mp4 /usr/share/ti/video/TearOfSteel-Short-1920x800.mov
    start playing /usr/share/ti/video/TearOfSteel-Short-1920x800.mov
    recvfrom 'demuxer' new pad' audio_0'
    link audio_0 pad
    recvfrom 'demuxer' new pad' video_0'
    link video_0 pad
    [ 7300.043522] omap_hwmod: mmu_ipu2: _wait_target_disable failed



    decoder = gst_element_factory_make("ffdec_h264","video-decoder");


    sink = gst_element_factory_make("autovideosink","video-output");


    Audioqueue = gst_element_factory_make("queue","audioqueue");


    Audiodecoder = gst_element_factory_make("ffdec_aac","audio-decoder");


    Audiosink = gst_element_factory_make("autoaudiosink","audio-output");

    if (!pipeline || !source || !demuxer || !queue || !decoder
    || !sink || !Audioqueue || !Audiodecoder
    || !Audiosink){
    g_printerr("can't creater element exit!\n");
    return(-1);
    }


    g_object_set(G_OBJECT(source),"location",argv[1],NULL);


    bus = gst_pipeline_get_bus(GST_PIPELINE(pipeline));
    gst_bus_add_watch(bus,bus_call,loop); //添加消息监视器
    gst_object_unref(bus);


    gst_bin_add_many(GST_BIN(pipeline),
    source,demuxer,queue,decoder,textoverlay,sink,
    Audioqueue,Audiodecoder,Audiosink,NULL);


    gst_element_link(source,demuxer);
    gst_element_link_many(queue,decoder,textoverlay,sink,NULL);
    gst_element_link_many(Audioqueue,Audiodecoder,Audiosink,NULL);

    g_signal_connect(demuxer,"pad-added",G_CALLBACK(on_pad_added),NULL);

    I can use this playing the MP4 file in ubuntu .
  • Hello, thanks for your help, I successed.
    this is my code


    #include <stdio.h>
    #include <string.h>
    #include <gst/gst.h>
    #include <glib.h>

    GstElement *pipeline,*source,*demuxer,
    *Videoqueue,*h264par,*Videodecoder,*Videosink,
    *Audioqueue,*Audiodecoder,*Audiosink;

    static gboolean bus_call(GstBus *bus,GstMessage *msg,gpointer data){
    GMainLoop *loop = (GMainLoop *)data;

    switch(GST_MESSAGE_TYPE(msg)){

    case GST_MESSAGE_EOS:

    g_print("play ending!\n");
    break;
    case GST_MESSAGE_ERROR: {
    gchar *debug;
    GError *error;
    gst_message_parse_error(msg,&error,&debug);
    g_free(debug);
    g_printerr("Error: %s\n",error->message);
    g_error_free(error);
    g_main_loop_quit(loop);
    break;
    }
    default:
    break;
    }
    return(TRUE);
    }

    static void on_pad_added(GstElement *element,GstPad *pad,gpointer data){

    char video[12]="video_0"; //char audio[9]="audio_00";
    char audio[12]="src_0";

    gchar *new_pad_name = GST_PAD_NAME(pad);

    g_print("recvfrom '%s' new pad' %s' \n",GST_ELEMENT_NAME (element),
    new_pad_name);

    GstPad *audio_sink_pad ,*video_sink_pad, *audio_source_pad;

    video_sink_pad = gst_element_get_static_pad(Videoqueue,"sink");
    audio_sink_pad = gst_element_get_static_pad(Audioqueue,"sink");

    ////////////////////////////////////////////////////////////////
    //add code
    audio_source_pad = gst_element_get_static_pad(Audiosink,"sink");
    /////////////////////////////////////////////////
    if(!strcmp(new_pad_name,video)){
    g_print("link %s pad\n",new_pad_name);
    gst_pad_link(pad,video_sink_pad);
    }


    ////////////////////// add code
    else if(!strcmp(new_pad_name,audio)){
    g_print("lind %s pad \n",new_pad_name);
    gst_pad_link(pad,audio_source_pad);
    }

    else{
    g_print("link %s pad\n",new_pad_name);
    gst_pad_link(pad,audio_sink_pad);
    }

    gst_object_unref(video_sink_pad);
    gst_object_unref(audio_sink_pad);
    gst_object_unref(audio_source_pad);
    }


    int main(int argc,char *argv[]){

    GMainLoop *loop;
    GstBus *bus;
    gst_init(&argc,&argv);
    loop = g_main_loop_new(NULL,FALSE);

    if (argc != 2)
    {
    g_printerr("You need file : %s <.moc filename>\n",argv[0]);
    return(-1);
    }


    pipeline = gst_pipeline_new("test-pipeline");
    if (!pipeline){
    g_printerr("pipeline creat failure,quit!\n");
    return(-1);
    }


    source = gst_element_factory_make("filesrc","file-source");
    if (!source){
    g_printerr("source creat failure,quit!\n");
    return(-1);
    }


    demuxer = gst_element_factory_make("qtdemux","demuxer");
    if (!demuxer){
    g_printerr("demuxer creat failure,quit!\n");
    return(-1);
    }


    Videoqueue = gst_element_factory_make("queue","videoqueue");
    if (!Videoqueue){
    g_printerr("Videoqueue creat failure,quit!\n");
    return(-1);
    }

    //h264parse
    h264par = gst_element_factory_make("h264parse","h264par");

    if (!h264par){
    g_printerr("h264par creat failure,quit!\n");
    return(-1);
    }


    Videodecoder = gst_element_factory_make("ducatih264dec","video-decoder");
    if (!Videodecoder){
    g_printerr("Videodecoder creat failure,quit!\n");
    return(-1);
    }


    Videosink = gst_element_factory_make("kmssink","video-output");
    if (!Videosink){
    g_printerr("Videosink creat failure,quit!\n");
    return(-1);
    }


    Audioqueue = gst_element_factory_make("queue","audioqueue");
    if (!Audioqueue){
    g_printerr("Audioqueue creat failure,quit!\n");
    return(-1);
    }

    Audiodecoder = gst_element_factory_make("decodebin","audio-decoder");
    if (!Audiodecoder){
    g_printerr("Audiodecoder creat failure,quit!\n");
    return(-1);
    }

    Audiosink = gst_element_factory_make("fakesink","audio-output");
    if (!Audiosink){
    g_printerr("Audiosink creat failure,quit!\n");
    return(-1);
    }

    g_object_set(G_OBJECT(source),"location",argv[1],NULL);

    bus = gst_pipeline_get_bus(GST_PIPELINE(pipeline));
    gst_bus_add_watch(bus,bus_call,loop); //添加消息监视器
    gst_object_unref(bus);


    gst_bin_add_many(GST_BIN(pipeline),
    source,demuxer,Videoqueue,h264par,Videodecoder,Videosink,
    Audioqueue,Audiodecoder,Audiosink,NULL);

    gst_element_link(source,demuxer);
    gst_element_link_many(Videoqueue,h264par,Videodecoder,Videosink,NULL);
    gst_element_link_many(Audioqueue,Audiodecoder,Audiosink,NULL);



    // g_signal_connect(demuxer,"pad-added",G_CALLBACK(on_pad_added),NULL);
    g_signal_connect(demuxer, "pad-added", G_CALLBACK(on_pad_added),NULL);
    g_signal_connect(Audiodecoder, "pad-added", G_CALLBACK(on_pad_added),NULL);



    g_print("start playing %s\n",argv[1]);
    gst_element_set_state(pipeline,GST_STATE_PLAYING);
    g_main_loop_run(loop);


    gst_element_set_state(pipeline,GST_STATE_NULL);

    gst_object_unref(GST_OBJECT(pipeline));
    return(0);
    }


    when I use gst-inspect decodebin command I found the Pad Templates: SRC template: 'src_u%'. Availability: Sometimes. So I must using


    g_signal_connect (decodebin, "pad-added", G_CALLBACK(on_pad_added), NULL); to link the pad.


    Thanks a lot.