h.264 encoder issue

Jean-Michel Hautbois jhautbois at gmail.com
Tue Sep 4 02:25:14 PDT 2012


Ok, you have to reproduce exactly the same launch line...
You have the following elements :
v4l2src
TIVidenc1
filesink

You need to name them exactly the same way.
enc = gst_element_factory_make("TIVidenc", "enc");
==> should be enc = gst_element_factory_make("TIVidenc1", "enc");

If you want to make rtp send, this is ok.
But don't forget to specify the properties of your objects too...

g_object_set (G_OBJECT (enc), "codecName", "h264enc", "engineName",
"codecServer", NULL);

And you need to use caps in order to specify your v4l2src element...

You can also use gst_parse_launch() which will help you a lot.
It can parse your line like gst-launch does, and you can get an
element using its name if you want to modify some properties (the IP
adress for instance).

When you test your program, you can launch it with GST_DEBUG : this
will tell you what is wrong :

$> GST_DEBUG=3 ./gstream

Happy hacking !
JM

2012/9/4 kartik natarajan <kartik8n8 at gmail.com>:
> Sure, here it is. Thanks for your cooperation
>
> This works
>
> gst-launch -v 'v4l2src always-copy=FALSE num-buffers=800 input-src=composite
> ! video/x-raw-yuv, format=\(fourcc\)NV12, width=720, height=480 ! TIVidenc1
> codecName=h264enc engineName=codecServer !filesink location=/home/gr8.264'
>
>
>
> #include <gst/gst.h>
>
> #include<glib.h>
>
>
> #define STATIC_IP "127.0.0.1"
>
>
> int main(int argc, char *argv[])
>
> {
>
>         GMainLoop *loop;
>
>
>
>         GstElement *pline, *src, *enc,*pay, *sink;
>
>         GstBus *bus;
>
>         guint major,minor, micro, nano;
>
>
>
>         gst_init(&argc, &argv);
>
>         gst_version(&major, &minor,&micro, &nano);
>
>         printf("gstreamer version: %d.%d.%d",major,minor,micro);
>
>         loop = g_main_loop_new(NULL, FALSE);
>
> pline = gst_pipeline_new ("Ossler video");
>
>         if(!pline)
>
>         g_printerr("\npipeline creation failed\n");
>
>         else
>
>         g_print("\npipeline created\n");
>
>         src = gst_element_factory_make("v4lsrc", "src");
>
>         if(!src)
>
>         g_printerr("\nsrc creation failed\n");
>
>         else
>
>         g_print("\nv4lsrc created\n");
>
>         //********************************************************
>
>         enc = gst_element_factory_make("TIVidenc", "enc");
>
>         if(!enc)
>
>         g_printerr("\nencoder TI-Video enc creation failed\n");
>
>         else
>
>         g_print("\n264 encoder created\n");
>
>         g_assert(enc);
>
> //      g_object_set();
>
>         //**************************************************************
>
>         sink = gst_element_factory_make("udpsink", "sink");
>
>         if(!sink)
>
>         g_printerr("\nudp sink creation failed\n");
>
>           else
>
>         g_print("\nudp sink created\n");
>
>         g_assert(sink);
>
>         g_object_set (sink, "port", 1234, "host", STATIC_IP, NULL);
>
>
>
>        pay = gst_element_factory_make("rtph264pay", "my264pay");
>
>         if(!sink)
>
>         g_printerr("\npayload element creation failed\n");
>
>         else
>
>         g_print("\n payloader created\n");
>
>
>
>         //**********************add all in
> bin*********************************
>
>         gst_bin_add_many(GST_BIN(pline),src,enc,pay,sink,NULL);
>
>
>
>
>
>         //*********************link
> them***************************************
>
>         gst_element_link_many(src,enc,pay,sink,NULL);
>
>
>
>
>
>
> //*********************cleanup***************************************
>
>         gst_element_set_state(pline,GST_STATE_NULL);
>
> //      gst_object_unref(pline);
>
> //      gst_main_loop_unref(loop);
>
>         return 0;
>
>         }
>
>
> I am compiling this code with this
>
> arm-none-linux-gnueabi-gcc -o gstream gstream.c -lz `pkg-config --cflags
> --libs gstreamer-0.10`
>
>
> I tried this too..
>
> arm-none-linux-gnueabi-gcc -o gstream gstream.c -lz  -L $(LIB)/ `pkg-config
> --cflags --libs gstreamer-0.10`
>
>   [where LIB is the path where the libgstticodec.so library is for the
> TIVidEnc is]
>
>
>
>
>
> N.Kartik
>
>
> On Tue, Sep 4, 2012 at 2:22 PM, Jean-Michel Hautbois <jhautbois at gmail.com>
> wrote:
>>
>> Well, in order to go further, we will need more information, a paste
>> of a part of your code, and a GST_DEBUG output for instance.
>> Can you paste your gst-launch line too ?
>>
>> JM
>>
>> 2012/9/4 kartik natarajan <kartik8n8 at gmail.com>:
>> > Thanks for your response.
>> > The TIVidEnc seems to fail too.
>> > Any suggestions?
>> > I am developing the gstreamer app using the same like only.
>> > I figured the elements I would need and have done a simple factory make,
>> > only the encoder seems to fail.
>> >
>> >
>> > On Tue, Sep 4, 2012 at 1:19 PM, Jean-Michel Hautbois
>> > <jhautbois at gmail.com>
>> > wrote:
>> >>
>> >> Hi,
>> >>
>> >> Your element should not be x264enc, but TIVidEnc :
>> >>  enc = gst_element_factory_make("x264enc", "encoder");
>> >> Then, you can set its properties using g_object_set();
>> >>
>> >> If you did not read it, please take a look at this documentation :
>> >>
>> >>
>> >> http://gstreamer.freedesktop.org/data/doc/gstreamer/head/manual/html/index.html
>> >>
>> >> Regards,
>> >> JM
>> >>
>> >> 2012/9/4 kartik natarajan <kartik8n8 at gmail.com>:
>> >> > Hi,
>> >> >     DVSDK on DM365, developing a gstreamer app to encode raw images
>> >> > into
>> >> > h.264 and store in file.
>> >> >  I have been able to execute a gst-launch where I provide
>> >> > codecName=h264enc
>> >> > to encode raw video and store it in a file. This works well.
>> >> > Now I build an application on gstreamer.
>> >> > I have tried doing enc = gst_element_factory_make("x264enc",
>> >> > "encoder");
>> >> > but it fails with enc getting a NULL. I tried "h264enc" and morbidly
>> >> > did
>> >> > "GstX264Enc" as well for the factory name but they failed too.
>> >> > How do I get this going ahead?
>> >> >
>> >> > Thanks in advance
>> >> >
>> >> > N.Kartik
>> >> >
>> >> >
>> >> > _______________________________________________
>> >> > gstreamer-devel mailing list
>> >> > gstreamer-devel at lists.freedesktop.org
>> >> > http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>> >> >
>> >> _______________________________________________
>> >> gstreamer-devel mailing list
>> >> gstreamer-devel at lists.freedesktop.org
>> >> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>> >
>> >
>> >
>> >
>> > --
>> > Believe in your dreams, they have a strange way of coming true!!!
>> >
>> > _______________________________________________
>> > gstreamer-devel mailing list
>> > gstreamer-devel at lists.freedesktop.org
>> > http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>> >
>> _______________________________________________
>> gstreamer-devel mailing list
>> gstreamer-devel at lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>
>
>
>
> --
> Believe in your dreams, they have a strange way of coming true!!!
>
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>


More information about the gstreamer-devel mailing list