[gst-devel] Video compression

Éric Beauchamp eric.beauchamp at gmail.com
Sat May 21 11:22:28 CEST 2005


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




More information about the gstreamer-devel mailing list