gst-launch works but application does not

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

gst-launch works but application does not

art vanderhoff
Hello,

Can you please give me some advice on why the below launch pipeline works but the application does not.

In the application the first filesrc starts to play but the output file does not rcv anything. the decoder callback indicates the pad is set so input looks ok.

Thanks
Art.


gst-launch-0.10 version 0.10.35
GStreamer 0.10.35
Debian squeeze amd64
---------------
gst-launch \
-v filesrc location=/home/fifo/mpegpipe1.yuv ! \
decodebin2 ! \
ffmpegcolorspace ! \
videoscale ! \
capsfilter  caps="video/x-raw-yuv,format=(fourcc)I420,width=384,height=216,framerate=(fraction)25/1"  ! \
filesink  location=/home/fifo/mpegpipe2.yuv
------------


------------
#include <gst/gst.h>
#include <glib.h>

static void
on_pad_added (GstElement *element,
              GstPad     *pad,
              gpointer    data)
{
  GstPad *sinkpad;
  GstElement *decoder = (GstElement *) data;

 g_print ("Dynamic pad created, linking out/in \n");

 sinkpad = gst_element_get_static_pad (decoder, "sink");

  gst_pad_link (pad, sinkpad);

  gst_object_unref (sinkpad);
}

int
main (int   argc,
      char *argv[])
{
  GMainLoop *loop;
  gboolean link_ok;

  GstElement *pipeline, *source, *decoder, *ffcs, *vidsc, *capsfout, *sink;
  GstBus *bus;
  GstCaps *filtercaps;


  /* Initialisation */
  gst_init (&argc, &argv);

  loop = g_main_loop_new (NULL, FALSE);

  /* Create gstreamer elements */
  pipeline = gst_pipeline_new ("video-player");
  source   = gst_element_factory_make ("filesrc",       "source");
  decoder  = gst_element_factory_make ("decodebin2",     "decoder");
  ffcs     = gst_element_factory_make ("ffmpegcolorspace", "ffcs");
  vidsc    = gst_element_factory_make ("videoscale", "vidsc");
  capsfout = gst_element_factory_make ("capsfilter", "capsfout");
  sink     = gst_element_factory_make ("filesink", "sink");

  if (!pipeline || !source || !decoder || !ffcs || !vidsc || !capsfout || !sink) {
    g_printerr ("One element could not be created. Exiting.\n");
    return -1;
  }


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

  bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline));

  gst_bin_add_many (GST_BIN (pipeline),
                    source, decoder, ffcs, vidsc, capsfout, sink, NULL);

  gst_element_link_many ( source, decoder, ffcs, vidsc, capsfout, sink,  NULL);

  g_signal_connect (decoder, "pad-added", G_CALLBACK (on_pad_added), decoder);

 filtercaps = gst_caps_new_simple("video/x-raw-yuv",
                   "format", GST_TYPE_FOURCC, GST_MAKE_FOURCC ('I', '4', '2', '0'),
                     "width", G_TYPE_INT, 384,
                         "height", G_TYPE_INT, 216,
                         "framerate", GST_TYPE_FRACTION, 25, 1,
                         NULL);

  g_object_set (G_OBJECT (capsfout), "caps", filtercaps, NULL);
        gst_caps_unref (filtercaps);


  /* Set the pipeline to "playing" state*/
  g_print ("Now playing: %s\n", argv[1]);
  gst_element_set_state (pipeline, GST_STATE_PLAYING);


  /* Iterate */
  g_print ("Running...\n");
  g_main_loop_run (loop);


  /* Out of the main loop, clean up nicely */
  g_print ("Returned, stopping playback\n");
  gst_element_set_state (pipeline, GST_STATE_NULL);

  g_print ("Deleting pipeline\n");
  gst_object_unref (GST_OBJECT (pipeline));

  return 0;
}

------------------
compiled with
gcc -Wall helloWorld.c -o helloWorld $(pkg-config --cflags --libs gstreamer-0.10)

Reply | Threaded
Open this post in threaded view
|

Re: gst-launch works but application does not

Stefan Sauer
On 02/04/2012 04:23 AM, art vanderhoff wrote:

> Hello,
>
> Can you please give me some advice on why the below launch pipeline works
> but the application does not.
>
> In the application the first filesrc starts to play but the output file does
> not rcv anything. the decoder callback indicates the pad is set so input
> looks ok.
>
> Thanks
> Art.
>
>
> gst-launch-0.10 version 0.10.35
> GStreamer 0.10.35
> Debian squeeze amd64
> ---------------
> gst-launch \
> -v filesrc location=/home/fifo/mpegpipe1.yuv ! \

if you want to just re-scale and/or re-layout raw data, use videoparse
instead of decodebin2.

Stefan

> decodebin2 ! \
> ffmpegcolorspace ! \
> videoscale ! \
> capsfilter
> caps="video/x-raw-yuv,format=(fourcc)I420,width=384,height=216,framerate=(fraction)25/1"
> ! \
> filesink  location=/home/fifo/mpegpipe2.yuv
> ------------
>
>
> ------------
> #include <gst/gst.h>
> #include <glib.h>
>
> static void
> on_pad_added (GstElement *element,
>               GstPad     *pad,
>               gpointer    data)
> {
>   GstPad *sinkpad;
>   GstElement *decoder = (GstElement *) data;
>
>  g_print ("Dynamic pad created, linking out/in \n");
>
>  sinkpad = gst_element_get_static_pad (decoder, "sink");
>
>   gst_pad_link (pad, sinkpad);
>
>   gst_object_unref (sinkpad);
> }
>
> int
> main (int   argc,
>       char *argv[])
> {
>   GMainLoop *loop;
>   gboolean link_ok;
>
>   GstElement *pipeline, *source, *decoder, *ffcs, *vidsc, *capsfout, *sink;
>   GstBus *bus;
>   GstCaps *filtercaps;
>
>
>   /* Initialisation */
>   gst_init (&argc, &argv);
>
>   loop = g_main_loop_new (NULL, FALSE);
>
>   /* Create gstreamer elements */
>   pipeline = gst_pipeline_new ("video-player");
>   source   = gst_element_factory_make ("filesrc",       "source");
>   decoder  = gst_element_factory_make ("decodebin2",     "decoder");
>   ffcs     = gst_element_factory_make ("ffmpegcolorspace", "ffcs");
>   vidsc    = gst_element_factory_make ("videoscale", "vidsc");
>   capsfout = gst_element_factory_make ("capsfilter", "capsfout");
>   sink     = gst_element_factory_make ("filesink", "sink");
>
>   if (!pipeline || !source || !decoder || !ffcs || !vidsc || !capsfout ||
> !sink) {
>     g_printerr ("One element could not be created. Exiting.\n");
>     return -1;
>   }
>
>
>   g_object_set (G_OBJECT (source), "location", argv[1], NULL);
>   g_object_set (G_OBJECT (sink), "location", argv[2], NULL);
>
>   bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline));
>
>   gst_bin_add_many (GST_BIN (pipeline),
>                     source, decoder, ffcs, vidsc, capsfout, sink, NULL);
>
>   gst_element_link_many ( source, decoder, ffcs, vidsc, capsfout, sink,
> NULL);
>
>   g_signal_connect (decoder, "pad-added", G_CALLBACK (on_pad_added),
> decoder);
>
>  filtercaps = gst_caps_new_simple("video/x-raw-yuv",
>            "format", GST_TYPE_FOURCC, GST_MAKE_FOURCC ('I', '4', '2',
> '0'),
>            "width", G_TYPE_INT, 384,
>          "height", G_TYPE_INT, 216,
>          "framerate", GST_TYPE_FRACTION, 25, 1,
>          NULL);
>
>   g_object_set (G_OBJECT (capsfout), "caps", filtercaps, NULL);
>         gst_caps_unref (filtercaps);
>
>
>   /* Set the pipeline to "playing" state*/
>   g_print ("Now playing: %s\n", argv[1]);
>   gst_element_set_state (pipeline, GST_STATE_PLAYING);
>
>
>   /* Iterate */
>   g_print ("Running...\n");
>   g_main_loop_run (loop);
>
>
>   /* Out of the main loop, clean up nicely */
>   g_print ("Returned, stopping playback\n");
>   gst_element_set_state (pipeline, GST_STATE_NULL);
>
>   g_print ("Deleting pipeline\n");
>   gst_object_unref (GST_OBJECT (pipeline));
>
>   return 0;
> }
>
> ------------------
> compiled with
> gcc -Wall helloWorld.c -o helloWorld $(pkg-config --cflags --libs
> gstreamer-0.10)
>
>
>
> --
> View this message in context: http://gstreamer-devel.966125.n4.nabble.com/gst-launch-works-but-application-does-not-tp4356468p4356468.html
> Sent from the GStreamer-devel mailing list archive at Nabble.com.
> _______________________________________________
> gstreamer-devel mailing list
> [hidden email]
> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

jerky video

safa
In reply to this post by art vanderhoff

Hello buddies,

I am testing this pipeline:

v2l4src ! videorate ! filter ! x264enc ! ffdec_h264 ! ffmpegcolorspace ! autovideosink

but the play back is so jerky (about 1 frame per 2 sec).
It will be highly appreciated if anybody can help me?

For filter: framerate=20/1,
For encoder quantizer=24.

Thank you in advance.

Safa

_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: jerky video

Derek Kulinski
On Mon, Feb 06, 2012 at 10:01:24AM -0800, safa vakili wrote:

> I am testing this pipeline:
>
> v2l4src ! videorate ! filter ! x264enc ! ffdec_h264 ! ffmpegcolorspace ! autovideosink
>
> but the play back is so jerky (about 1 frame per 2 sec).
> It will be highly appreciated if anybody can help me?
>
> For filter: framerate=20/1,
> For encoder quantizer=24.
>
> Thank you in advance.

I think that's normal. Encoding and decoding are CPU intensive tasks.
You can use smaller resolution and/or different speed preset on x264enc.

Derek

_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: gst-launch works but application does not

art vanderhoff
In reply to this post by Stefan Sauer
Thank you for the advice Stefan,

With some tweaking I did get the app to parse with input files as h264/flv.  
I would like to get it to work with rawvideo yuv from a ffmpeg fifo


I tried your suggestion but get.....

videomixer2 videomixer2.c:336:gst_videomixer2_pad_sink_setcaps:<videomixer:sink_0> Caps not compatible with other pads' caps

using both the videoparse and decodebin2.

Can you advise what the correct chain would be for the following input
ffmpeg -i "rtsp://192.168.20.112:551/channel1" -an -s 640x352 -vcodec rawvideo /home/fifo/mpegpipe2.yuv

source2   = gst_element_factory_make ("filesrc",       "source2");
decoder2  = gst_element_factory_make ("videoparse",     "decoder2");
ffcs2    = gst_element_factory_make ("ffmpegcolorspace", "ffcs2");
vidsc2    = gst_element_factory_make ("videoscale", "vidsc2");
capsfout2 = gst_element_factory_make ("capsfilter", "capsfout2");


Many thanks again for your help.

thx
Art