[gst-devel] Video compression

Stefan Kost ensonic at hora-obscura.de
Tue May 24 11:21:12 CEST 2005


Hi Éric,

I belive you need to add the items first, then trying to link them. Generally I 
recommend that you check the return value before continuing. As an example 
gst_element_link_many() returns wheter it worked or not.
http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstElement.html#gst-element-link-many

Ciao
   Stefan
> Hi, 
> 
> I'm a student in electrical engineering and I'm working on a little
> project this summer. I'm sorry for the mistakes because English is not
> my first language. I've used Gstreamer to display the images that come
> from a laparoscope (it's a firewire camera that is used for surgery)
> and it works perfectly.
> 
> I can also record video in dv format, but it takes to much memory
> space. Therefore, I've decided to use a encoder to do real time
> compression. I've tried many combinations of decoder and encoder and
> it always makes a segmentation fault error. I can't figure what I'm
> doing wrong. Here's a simple program I wrote based on examples that
> I've found on the web:
> 
> int main (int argc, char *argv[])
> {
> 
>   GstElement *pipeline, *source, *decoder, *encoder, *sink;
>   int i = 0;
> 
>   /* initialize GStreamer */
>   gst_init (&argc, &argv);
> 
>   /* create elements */
>   pipeline = gst_pipeline_new ("pilpeline");
>   source = gst_element_factory_make ("dv1394src", "source");
>   decoder = gst_element_factory_make ("ffdec_dvvideo", "decoder");
>   encoder = gst_element_factory_make ("ffenc_mpeg2video", "encoder");
>   sink = gst_element_factory_make ("filesink", "sink");
> 
>   g_object_set (G_OBJECT (sink), "location", argv[1], NULL );
> 
>   /* link together */
>   gst_element_link_many (source, decoder, encoder, sink, NULL);
> 
>   /* put all elements in a bin */
>   gst_bin_add_many (GST_BIN (pipeline), source, decoder, encoder, sink, NULL);
> 
>   /* Now set to playing */
>   gst_element_set_state (pipeline, GST_STATE_PLAYING);
> 
> 
>   /* and now iterate */
>    while ( i < 1000 )
>   {
>         i++;
>         gst_bin_iterate (GST_BIN (pipeline));
>   };
> 
>   /* clean up nicely */
>   gst_element_set_state (pipeline, GST_STATE_NULL);
>   gst_object_unref (GST_OBJECT (pipeline));
> 
>   return 0;
> }
> 
> Here's some information about the camera when it's running with Kino:
> YUY2 720x480 NTSC 4:3 29.97 fps.
> 
> Thanks in advance for your help!
> 
> Éric
> 
> 
> -------------------------------------------------------
> This SF.Net email is sponsored by Oracle Space Sweepstakes
> Want to be the first software developer in space?
> Enter now for the Oracle Space Sweepstakes!
> http://ads.osdn.com/?ad_idt12&alloc_id344&op=click
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gstreamer-devel





More information about the gstreamer-devel mailing list