[gst-devel] pixbuf from video file

Luis de Bethencourt bethencourt at gmail.com
Tue Sep 18 22:10:48 CEST 2007


I'm trying this other code now:

-------------------------------------------------------------------------------------------------------

	play = gst_element_factory_make ("playbin", "play");
	g_object_set (G_OBJECT (play), "uri", file_src, NULL);

	bus = gst_pipeline_get_bus (GST_PIPELINE (play));
	gst_bus_add_watch (bus, bus_call, loop);
	gst_object_unref (bus);

  gst_element_set_state (play, GST_STATE_PLAYING);

	//gst_element_set_state (pipeline, GST_STATE_PAUSED);
	gst_element_get_state (play, NULL, NULL, -1);
	gst_element_seek_simple(play, GST_FORMAT_TIME,
		GST_SEEK_FLAG_KEY_UNIT, 100);

	g_object_get (play, "frame", &buffer, NULL);

	pixbuf = gdk_pixbuf_new_from_data (GST_BUFFER_DATA (buffer),
		GDK_COLORSPACE_RGB, FALSE, 8, 120, 90,
		GST_ROUND_UP_4 (120 * 3), NULL, buffer);

-------------------------------------------------------------------------------------------------------

But it seams like the yuv to rgb is not done properly.
Any suggestions,

Luis de Bethencourt

On 9/18/07, Luis de Bethencourt <bethencourt at gmail.com> wrote:
> Help!!
>
> After 5 days running in circles with this problem, and trying a few
> different approaches suggested in the irc channel. I don't get this to
> work at all, I'm getting terribly frustrated and desperate. I really
> need this thumbnailer for my project.
>
> This is my code:
>
> -----------------------------------------------------------------------------------------------------
>
>         pipeline = gst_pipeline_new ("pipeline");
>         play = gst_bin_new ("my_bin");
>
>         src = gst_element_factory_make ("filesrc", "source");
>         g_object_set (G_OBJECT (src), "location", file_src, NULL);
>
>         parser = gst_element_factory_make ("decodebin", "mpeg-parser");
>         decoder = gst_element_factory_make ("ffmpegcolorspace", "mpeg-decoder");
>         videoscale = gst_element_factory_make ("videoscale", "videoscale");
>         g_object_set (G_OBJECT (videoscale),
>                 "video/x-raw-rgb,width=640,height=480,bpp=24,depth=24", NULL);
>         fakesink = gst_element_factory_make ("fakesink", NULL);
>
>         if (!pipeline || !src || !parser || !decoder || !videoscale || !fakesink) {
>                 g_print ("One element could not be created\n");
>         }
>
>         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 (play),
>                 src, parser, decoder, videoscale, fakesink, NULL);
>         gst_bin_add (GST_BIN (pipeline), play);
>
>         gst_element_link (source, parser);
>         gst_element_link_many (decoder, videoscale, fakesink, NULL);
>         g_signal_connect (parser, "pad-added", G_CALLBACK (new_pad), NULL);
>
>         //gst_element_set_state (pipeline, GST_STATE_PAUSED);
>         gst_element_get_state (pipeline, NULL, NULL, -1);
>         gst_element_seek_simple(pipeline, GST_FORMAT_PERCENT,
>                 GST_SEEK_FLAG_KEY_UNIT, 500000);
>
>         g_object_get (play, "frame", &buffer, NULL);
>
>         pixbuf = gdk_pixbuf_new_from_data (GST_BUFFER_DATA (buffer),
>                 GDK_COLORSPACE_RGB, FALSE, 8, 120, 90,
>                 GST_ROUND_UP_4 (120 * 3), NULL, buffer);
>
> ------------------------------------------------------------------------------------------------------
>
> And this are the problems I'm getting:
> object class `GstBin' has no property named `frame'
> object class `GstVideoScale' has no property named
> `video/x-raw-rgb,width=640,height=480,bpp=24,depth=24'
> assertion `GST_IS_ELEMENT (src)' failed
> and then probably the buffer format will be wrong.
>
> I will deeply thank any help,
> Luis de Bethencourt
>
>
> On 8/6/07, David Schleef <ds at schleef.org> wrote:
> > On Thu, Aug 02, 2007 at 01:15:30PM +0200, Fredrik Persson wrote:
> > > To make it absolutely clear; I think that the gstreamer developers are doing
> > > a great job!
> > >
> > > I also absolutely think that they also appreciate "user input" (in this
> > > case, mine and Luis') on what features we'd like to see in gstreamer.
> > > Therefore, I like to take the opportunity to bring up this suggestion again.
> > > I think that every time this question is brought up here on the mailinglist
> > > is strengthens the point that a "snapshot element" in gstreamer is a good
> > > idea and that it would increase the attractiveness of the entire gstreamer
> > > framework.
> >
> > It's also a FAQ that can be answered with a simple mailing list search:
> >
> >   http://search.gmane.org/?query=thumbnails&group=gmane.comp.video.gstreamer.devel
> >
> >
> >
> > dave...
> >
> >
> >
>
>
> --
> Luis de Bethencourt Guimerá
> luisbg
> <bethencourt at gmail.com>
> GPG: B0ED1326
>


-- 
Luis de Bethencourt Guimerá
luisbg
<bethencourt at gmail.com>
GPG: B0ED1326




More information about the gstreamer-devel mailing list