Hi,
I am trying to access RGB data of image frames in a mov -file. Below is code that I have constructed using gstreamer examples and documentation. cb_have_data() doesn't seem to give me RGB data. I am setting the data to 0 (=black?), but I can see shortly a green screen on the video and then comes invalid pointer error. How can I read RGB data from a video, frame by frame? I need also a way to control the flow of frames, in a way that once I have done with processing one frame I could ask gstreamer to give me next frame. Code examples would be great. Thanks #include <iostream> #include <gst/gst.h> GstElement *pipeline, *video; static gboolean cb_have_data (GstPad *pad, GstBuffer *buffer, gpointer u_data) { guint16 *data = (guint16 *) GST_BUFFER_DATA (buffer); GstCaps *caps = gst_buffer_get_caps(buffer); char m_width[] = "width"; char m_height[] = "height"; GstStructure *structure = gst_caps_get_structure(caps, 0); const GValue *width_gval = gst_structure_get_value(structure, m_width); const GValue *height_gval = gst_structure_get_value(structure, m_height); int width = g_value_get_int (width_gval); int height = g_value_get_int(height_gval); for (int y = 0; y < height; y++) { for (int x = 0; x < width; x++) { data[width*y + x] = 0; } } return TRUE; } static void cb_newpad (GstElement *decodebin, GstPad *pad, gboolean last, gpointer data) { GstCaps *caps; GstStructure *str; GstPad *videopad; videopad = gst_element_get_static_pad (video, "sink"); if (GST_PAD_IS_LINKED (videopad)) { g_object_unref (videopad); return; } caps = gst_pad_get_caps (pad); str = gst_caps_get_structure (caps, 0); if (!g_strrstr (gst_structure_get_name (str), "video")) { gst_caps_unref (caps); gst_object_unref (videopad); return; } gst_caps_unref (caps); gst_pad_link (pad, videopad); g_object_unref (videopad); } gint main (gint argc, gchar *argv[]) { GMainLoop *loop; GstElement *src, *dec, *filter, *cs, *sink; GstPad *videopad; GstBus *bus; gst_init (&argc, &argv); loop = g_main_loop_new (NULL, FALSE); pipeline = gst_pipeline_new ("pipeline"); bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline)); src = gst_element_factory_make ("filesrc", "source"); g_object_set (G_OBJECT (src), "location", "/home/sammy/src/SamScanPlus/src/testi.mov", NULL); dec = gst_element_factory_make ("decodebin", "decoder"); g_signal_connect (dec, "new-decoded-pad", G_CALLBACK (cb_newpad), NULL); gst_bin_add_many (GST_BIN (pipeline), src, dec, NULL); gst_element_link (src, dec); video = gst_bin_new ("videobin"); cs = gst_element_factory_make ("ffmpegcolorspace", "cs"); videopad = gst_element_get_static_pad (cs, "sink"); sink = gst_element_factory_make ("xvimagesink", "sink"); gst_bin_add_many (GST_BIN (video), cs, sink, NULL); gst_element_link_many(cs, sink, NULL); gst_element_add_pad (video, gst_ghost_pad_new ("sink", videopad)); gst_object_unref (videopad); gst_bin_add (GST_BIN (pipeline), video); GstPad *pad = gst_element_get_pad (cs, "src"); gst_pad_add_buffer_probe (pad, G_CALLBACK (cb_have_data), NULL); gst_object_unref (pad); gst_element_set_state (pipeline, GST_STATE_PLAYING); g_main_loop_run (loop); gst_element_set_state (pipeline, GST_STATE_NULL); gst_object_unref (GST_OBJECT (pipeline)); return 0; } _______________________________________________ gstreamer-devel mailing list [hidden email] http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel |
On 10/01/2011 10:16 AM, Sami Pietila wrote:
> Hi, > > I am trying to access RGB data of image frames in a mov -file. Below > is code that I have constructed using gstreamer examples and > documentation. cb_have_data() doesn't seem to give me RGB data. I am > setting the data to 0 (=black?), but I can see shortly a green screen > on the video and then comes invalid pointer error. when you see green on all 0, you are in a yuv format and not rgb. In the code below the ffmpegcolorspace wont convert anything as xvimagsink will prefer yuv. If you change the later to ximagesink you'll get RGB. > How can I read RGB data from a video, frame by frame? I need also a > way to control the flow of frames, in a way that once I have done with > processing one frame I could ask gstreamer to give me next frame. Code > examples would be great. If you wants to modify the image data you better write an element. Stefan > Thanks > > > #include <iostream> > #include <gst/gst.h> > > GstElement *pipeline, *video; > > static gboolean > cb_have_data (GstPad *pad, GstBuffer *buffer, gpointer u_data) { > > guint16 *data = (guint16 *) GST_BUFFER_DATA (buffer); > GstCaps *caps = gst_buffer_get_caps(buffer); > > char m_width[] = "width"; > char m_height[] = "height"; > > GstStructure *structure = gst_caps_get_structure(caps, 0); > > const GValue *width_gval = gst_structure_get_value(structure, m_width); > const GValue *height_gval = gst_structure_get_value(structure, m_height); > > int width = g_value_get_int (width_gval); > int height = g_value_get_int(height_gval); > > for (int y = 0; y < height; y++) { > for (int x = 0; x < width; x++) { > data[width*y + x] = 0; > } > } > > return TRUE; > } > > static void > cb_newpad (GstElement *decodebin, > GstPad *pad, > gboolean last, > gpointer data) > { > GstCaps *caps; > GstStructure *str; > GstPad *videopad; > > videopad = gst_element_get_static_pad (video, "sink"); > if (GST_PAD_IS_LINKED (videopad)) { > g_object_unref (videopad); > return; > } > > caps = gst_pad_get_caps (pad); > str = gst_caps_get_structure (caps, 0); > if (!g_strrstr (gst_structure_get_name (str), "video")) { > gst_caps_unref (caps); > gst_object_unref (videopad); > return; > } > gst_caps_unref (caps); > > gst_pad_link (pad, videopad); > > g_object_unref (videopad); > } > > gint main (gint argc, gchar *argv[]) > { > GMainLoop *loop; > GstElement *src, *dec, *filter, *cs, *sink; > GstPad *videopad; > GstBus *bus; > > gst_init (&argc, &argv); > loop = g_main_loop_new (NULL, FALSE); > > pipeline = gst_pipeline_new ("pipeline"); > > bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline)); > > src = gst_element_factory_make ("filesrc", "source"); > g_object_set (G_OBJECT (src), "location", > "/home/sammy/src/SamScanPlus/src/testi.mov", NULL); > dec = gst_element_factory_make ("decodebin", "decoder"); > g_signal_connect (dec, "new-decoded-pad", G_CALLBACK (cb_newpad), NULL); > gst_bin_add_many (GST_BIN (pipeline), src, dec, NULL); > gst_element_link (src, dec); > > video = gst_bin_new ("videobin"); > cs = gst_element_factory_make ("ffmpegcolorspace", "cs"); > videopad = gst_element_get_static_pad (cs, "sink"); > sink = gst_element_factory_make ("xvimagesink", "sink"); > gst_bin_add_many (GST_BIN (video), cs, sink, NULL); > gst_element_link_many(cs, sink, NULL); > gst_element_add_pad (video, gst_ghost_pad_new ("sink", videopad)); > gst_object_unref (videopad); > gst_bin_add (GST_BIN (pipeline), video); > > GstPad *pad = gst_element_get_pad (cs, "src"); > gst_pad_add_buffer_probe (pad, G_CALLBACK (cb_have_data), NULL); > gst_object_unref (pad); > > gst_element_set_state (pipeline, GST_STATE_PLAYING); > g_main_loop_run (loop); > > gst_element_set_state (pipeline, GST_STATE_NULL); > gst_object_unref (GST_OBJECT (pipeline)); > > return 0; > } > _______________________________________________ > 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 |
Hi,
Thanks for reply! I changed to ximagesink and now I am getting RGB data. I don't need to modify movie frames, but I need to read them and do some calculations. Calculations might take some time, so I need a way to control how gstreamers feeds the frames. That is, I need a way to ask next frame from gstreamer instead of gstreamer feeding them at a constant rate. How can I get a new frame only when requested? 2011/10/4 Stefan Sauer <[hidden email]>: > On 10/01/2011 10:16 AM, Sami Pietila wrote: >> Hi, >> >> I am trying to access RGB data of image frames in a mov -file. Below >> is code that I have constructed using gstreamer examples and >> documentation. cb_have_data() doesn't seem to give me RGB data. I am >> setting the data to 0 (=black?), but I can see shortly a green screen >> on the video and then comes invalid pointer error. > when you see green on all 0, you are in a yuv format and not rgb. In the > code below the ffmpegcolorspace wont convert anything as xvimagsink will > prefer yuv. If you change the later to ximagesink you'll get RGB. > >> How can I read RGB data from a video, frame by frame? I need also a >> way to control the flow of frames, in a way that once I have done with >> processing one frame I could ask gstreamer to give me next frame. Code >> examples would be great. > > If you wants to modify the image data you better write an element. > > Stefan > >> Thanks >> >> >> #include <iostream> >> #include <gst/gst.h> >> >> GstElement *pipeline, *video; >> >> static gboolean >> cb_have_data (GstPad *pad, GstBuffer *buffer, gpointer u_data) { >> >> guint16 *data = (guint16 *) GST_BUFFER_DATA (buffer); >> GstCaps *caps = gst_buffer_get_caps(buffer); >> >> char m_width[] = "width"; >> char m_height[] = "height"; >> >> GstStructure *structure = gst_caps_get_structure(caps, 0); >> >> const GValue *width_gval = gst_structure_get_value(structure, m_width); >> const GValue *height_gval = gst_structure_get_value(structure, m_height); >> >> int width = g_value_get_int (width_gval); >> int height = g_value_get_int(height_gval); >> >> for (int y = 0; y < height; y++) { >> for (int x = 0; x < width; x++) { >> data[width*y + x] = 0; >> } >> } >> >> return TRUE; >> } >> >> static void >> cb_newpad (GstElement *decodebin, >> GstPad *pad, >> gboolean last, >> gpointer data) >> { >> GstCaps *caps; >> GstStructure *str; >> GstPad *videopad; >> >> videopad = gst_element_get_static_pad (video, "sink"); >> if (GST_PAD_IS_LINKED (videopad)) { >> g_object_unref (videopad); >> return; >> } >> >> caps = gst_pad_get_caps (pad); >> str = gst_caps_get_structure (caps, 0); >> if (!g_strrstr (gst_structure_get_name (str), "video")) { >> gst_caps_unref (caps); >> gst_object_unref (videopad); >> return; >> } >> gst_caps_unref (caps); >> >> gst_pad_link (pad, videopad); >> >> g_object_unref (videopad); >> } >> >> gint main (gint argc, gchar *argv[]) >> { >> GMainLoop *loop; >> GstElement *src, *dec, *filter, *cs, *sink; >> GstPad *videopad; >> GstBus *bus; >> >> gst_init (&argc, &argv); >> loop = g_main_loop_new (NULL, FALSE); >> >> pipeline = gst_pipeline_new ("pipeline"); >> >> bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline)); >> >> src = gst_element_factory_make ("filesrc", "source"); >> g_object_set (G_OBJECT (src), "location", >> "/home/sammy/src/SamScanPlus/src/testi.mov", NULL); >> dec = gst_element_factory_make ("decodebin", "decoder"); >> g_signal_connect (dec, "new-decoded-pad", G_CALLBACK (cb_newpad), NULL); >> gst_bin_add_many (GST_BIN (pipeline), src, dec, NULL); >> gst_element_link (src, dec); >> >> video = gst_bin_new ("videobin"); >> cs = gst_element_factory_make ("ffmpegcolorspace", "cs"); >> videopad = gst_element_get_static_pad (cs, "sink"); >> sink = gst_element_factory_make ("xvimagesink", "sink"); >> gst_bin_add_many (GST_BIN (video), cs, sink, NULL); >> gst_element_link_many(cs, sink, NULL); >> gst_element_add_pad (video, gst_ghost_pad_new ("sink", videopad)); >> gst_object_unref (videopad); >> gst_bin_add (GST_BIN (pipeline), video); >> >> GstPad *pad = gst_element_get_pad (cs, "src"); >> gst_pad_add_buffer_probe (pad, G_CALLBACK (cb_have_data), NULL); >> gst_object_unref (pad); >> >> gst_element_set_state (pipeline, GST_STATE_PLAYING); >> g_main_loop_run (loop); >> >> gst_element_set_state (pipeline, GST_STATE_NULL); >> gst_object_unref (GST_OBJECT (pipeline)); >> >> return 0; >> } >> _______________________________________________ >> 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 > gstreamer-devel mailing list [hidden email] http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel |
On 10/06/2011 11:20 PM, Sami Pietila wrote:
> Hi, > > Thanks for reply! I changed to ximagesink and now I am getting RGB data. > > I don't need to modify movie frames, but I need to read them and do > some calculations. Calculations might take some time, so I need a way > to control how gstreamers feeds the frames. That is, I need a way to > ask next frame from gstreamer instead of gstreamer feeding them at a > constant rate. > > How can I get a new frame only when requested? In your pad_probe just do the calculation as you need. ximagesink will throw away late frames. A smarter way might be to do: ... ! colorspace ! tee name = t ! queue leaky=upstream ! appsink t. ! queue ! ximagesink This way you can use get the frames from appsink (better that using pad-probes or fakesink with the handoff signal). Also the playback gets not disturbed and you process the frames on appsink as you manage. All other frames get dropped. Stefan > 2011/10/4 Stefan Sauer <[hidden email]>: >> On 10/01/2011 10:16 AM, Sami Pietila wrote: >>> Hi, >>> >>> I am trying to access RGB data of image frames in a mov -file. Below >>> is code that I have constructed using gstreamer examples and >>> documentation. cb_have_data() doesn't seem to give me RGB data. I am >>> setting the data to 0 (=black?), but I can see shortly a green screen >>> on the video and then comes invalid pointer error. >> when you see green on all 0, you are in a yuv format and not rgb. In the >> code below the ffmpegcolorspace wont convert anything as xvimagsink will >> prefer yuv. If you change the later to ximagesink you'll get RGB. >> >>> How can I read RGB data from a video, frame by frame? I need also a >>> way to control the flow of frames, in a way that once I have done with >>> processing one frame I could ask gstreamer to give me next frame. Code >>> examples would be great. >> If you wants to modify the image data you better write an element. >> >> Stefan >> >>> Thanks >>> >>> >>> #include <iostream> >>> #include <gst/gst.h> >>> >>> GstElement *pipeline, *video; >>> >>> static gboolean >>> cb_have_data (GstPad *pad, GstBuffer *buffer, gpointer u_data) { >>> >>> guint16 *data = (guint16 *) GST_BUFFER_DATA (buffer); >>> GstCaps *caps = gst_buffer_get_caps(buffer); >>> >>> char m_width[] = "width"; >>> char m_height[] = "height"; >>> >>> GstStructure *structure = gst_caps_get_structure(caps, 0); >>> >>> const GValue *width_gval = gst_structure_get_value(structure, m_width); >>> const GValue *height_gval = gst_structure_get_value(structure, m_height); >>> >>> int width = g_value_get_int (width_gval); >>> int height = g_value_get_int(height_gval); >>> >>> for (int y = 0; y < height; y++) { >>> for (int x = 0; x < width; x++) { >>> data[width*y + x] = 0; >>> } >>> } >>> >>> return TRUE; >>> } >>> >>> static void >>> cb_newpad (GstElement *decodebin, >>> GstPad *pad, >>> gboolean last, >>> gpointer data) >>> { >>> GstCaps *caps; >>> GstStructure *str; >>> GstPad *videopad; >>> >>> videopad = gst_element_get_static_pad (video, "sink"); >>> if (GST_PAD_IS_LINKED (videopad)) { >>> g_object_unref (videopad); >>> return; >>> } >>> >>> caps = gst_pad_get_caps (pad); >>> str = gst_caps_get_structure (caps, 0); >>> if (!g_strrstr (gst_structure_get_name (str), "video")) { >>> gst_caps_unref (caps); >>> gst_object_unref (videopad); >>> return; >>> } >>> gst_caps_unref (caps); >>> >>> gst_pad_link (pad, videopad); >>> >>> g_object_unref (videopad); >>> } >>> >>> gint main (gint argc, gchar *argv[]) >>> { >>> GMainLoop *loop; >>> GstElement *src, *dec, *filter, *cs, *sink; >>> GstPad *videopad; >>> GstBus *bus; >>> >>> gst_init (&argc, &argv); >>> loop = g_main_loop_new (NULL, FALSE); >>> >>> pipeline = gst_pipeline_new ("pipeline"); >>> >>> bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline)); >>> >>> src = gst_element_factory_make ("filesrc", "source"); >>> g_object_set (G_OBJECT (src), "location", >>> "/home/sammy/src/SamScanPlus/src/testi.mov", NULL); >>> dec = gst_element_factory_make ("decodebin", "decoder"); >>> g_signal_connect (dec, "new-decoded-pad", G_CALLBACK (cb_newpad), NULL); >>> gst_bin_add_many (GST_BIN (pipeline), src, dec, NULL); >>> gst_element_link (src, dec); >>> >>> video = gst_bin_new ("videobin"); >>> cs = gst_element_factory_make ("ffmpegcolorspace", "cs"); >>> videopad = gst_element_get_static_pad (cs, "sink"); >>> sink = gst_element_factory_make ("xvimagesink", "sink"); >>> gst_bin_add_many (GST_BIN (video), cs, sink, NULL); >>> gst_element_link_many(cs, sink, NULL); >>> gst_element_add_pad (video, gst_ghost_pad_new ("sink", videopad)); >>> gst_object_unref (videopad); >>> gst_bin_add (GST_BIN (pipeline), video); >>> >>> GstPad *pad = gst_element_get_pad (cs, "src"); >>> gst_pad_add_buffer_probe (pad, G_CALLBACK (cb_have_data), NULL); >>> gst_object_unref (pad); >>> >>> gst_element_set_state (pipeline, GST_STATE_PLAYING); >>> g_main_loop_run (loop); >>> >>> gst_element_set_state (pipeline, GST_STATE_NULL); >>> gst_object_unref (GST_OBJECT (pipeline)); >>> >>> return 0; >>> } >>> _______________________________________________ >>> 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 >> > _______________________________________________ > 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 |
In reply to this post by Sami Pietila
>> I don't need to modify movie frames, but I need to read them and do
>> some calculations. Calculations might take some time, so I need a way >> to control how gstreamers feeds the frames. That is, I need a way to >> ask next frame from gstreamer instead of gstreamer feeding them at a >> constant rate. >> >> How can I get a new frame only when requested? > > In your pad_probe just do the calculation as you need. ximagesink will > throw away late frames. A smarter way might be to do: > > ... ! colorspace ! tee name = t ! queue leaky=upstream ! appsink > t. ! queue ! ximagesink > > This way you can use get the frames from appsink (better that using > pad-probes or fakesink with the handoff signal). Also the playback gets > not disturbed and you process the frames on appsink as you manage. All > other frames get dropped. Hey, I'm in the same situation, I want to get the frames, and I know I can manage the frame rate by using something videorate element, but that will drop frames. I want to process some stuff for every frame on the picture, so I need to slow down the frame rate playback sometimes, but without losing frames. I've seen a way to slow down the playback using gnonlin filesource element, but that doesn't convince me either. Is there other way ? -- Acta est fabula _______________________________________________ gstreamer-devel mailing list [hidden email] http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel |
Hi,
I have also a situation where frames can't be lost. I can't also say how long processing a frame takes so I need to ask next frame from gstreamer when processing previous frame is is done. 2011/10/7 Erick Pérez <[hidden email]>: >>> I don't need to modify movie frames, but I need to read them and do >>> some calculations. Calculations might take some time, so I need a way >>> to control how gstreamers feeds the frames. That is, I need a way to >>> ask next frame from gstreamer instead of gstreamer feeding them at a >>> constant rate. >>> >>> How can I get a new frame only when requested? >> >> In your pad_probe just do the calculation as you need. ximagesink will >> throw away late frames. A smarter way might be to do: >> >> ... ! colorspace ! tee name = t ! queue leaky=upstream ! appsink >> t. ! queue ! ximagesink >> >> This way you can use get the frames from appsink (better that using >> pad-probes or fakesink with the handoff signal). Also the playback gets >> not disturbed and you process the frames on appsink as you manage. All >> other frames get dropped. > > Hey, I'm in the same situation, I want to get the frames, and I know I > can manage the frame rate by using something videorate element, but > that will drop frames. I want to process some stuff for every frame on > the picture, so I need to slow down the frame rate playback sometimes, > but without losing frames. I've seen a way to slow down the playback > using gnonlin filesource element, but that doesn't convince me either. > Is there other way ? > > -- > Acta est fabula > _______________________________________________ > 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 |
FWIW, I could be way off base here, but it seems to me that you have conflicting requirements with this tee. Either you want to process the stream as fast as possible, which may be slower than real time, or you want to play it in real time, dropping frames as required.
So I would suggest you have a simple serial pipeline with no T. In appsink it describes to ways to pace with "emit-signals" to get blocking and nonblocking variants.
http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-base-libs/html/gst-plugins-base-libs-appsink.htmlMike Mitchell On Fri, Oct 7, 2011 at 11:44 AM, Sami Pietilä <[hidden email]> wrote: Hi, _______________________________________________ gstreamer-devel mailing list [hidden email] http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel |
In reply to this post by Erick Pérez Castellanos
On 10/07/2011 02:20 PM, Erick Pérez wrote:
>>> I don't need to modify movie frames, but I need to read them and do >>> some calculations. Calculations might take some time, so I need a way >>> to control how gstreamers feeds the frames. That is, I need a way to >>> ask next frame from gstreamer instead of gstreamer feeding them at a >>> constant rate. >>> >>> How can I get a new frame only when requested? >> In your pad_probe just do the calculation as you need. ximagesink will >> throw away late frames. A smarter way might be to do: >> >> ... ! colorspace ! tee name = t ! queue leaky=upstream ! appsink >> t. ! queue ! ximagesink >> >> This way you can use get the frames from appsink (better that using >> pad-probes or fakesink with the handoff signal). Also the playback gets >> not disturbed and you process the frames on appsink as you manage. All >> other frames get dropped. > Hey, I'm in the same situation, I want to get the frames, and I know I > can manage the frame rate by using something videorate element, but > that will drop frames. I want to process some stuff for every frame on > the picture, so I need to slow down the frame rate playback sometimes, > but without losing frames. I've seen a way to slow down the playback > using gnonlin filesource element, but that doesn't convince me either. > Is there other way ? > can turn sync off on the sink. Stefan _______________________________________________ gstreamer-devel mailing list [hidden email] http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel |
In reply to this post by Sami Pietila
> FWIW, I could be way off base here, but it seems to me that you have
> conflicting requirements with this tee. Either you want to process the > stream as fast as possible, which may be slower than real time, or you want > to play it in real time, dropping frames as required. I want to process the frames, not play it. But I think I can accomplish that by using tee, and and one side of the tee for playback and the other for processing. > So I would suggest you have a simple serial pipeline with no T. > > In appsink it describes to ways to pace with "emit-signals" to get blocking > and nonblocking variants. > http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-base-libs/html/gst-plugins-base-libs-appsink.html I jus reviewd AppSink, it seems it fits my needs. Thxs u -- Acta est fabula _______________________________________________ gstreamer-devel mailing list [hidden email] http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel |
In reply to this post by Stefan Sauer
Hi,
How can I turn sync off on the sink? I tried: g_object_set (G_OBJECT (sink), "synchronous", false, NULL); Sink is "ximagesink". Frames are still being dropped. 2011/10/8 Stefan Sauer <[hidden email]>: > On 10/07/2011 02:20 PM, Erick Pérez wrote: >>>> I don't need to modify movie frames, but I need to read them and do >>>> some calculations. Calculations might take some time, so I need a way >>>> to control how gstreamers feeds the frames. That is, I need a way to >>>> ask next frame from gstreamer instead of gstreamer feeding them at a >>>> constant rate. >>>> >>>> How can I get a new frame only when requested? >>> In your pad_probe just do the calculation as you need. ximagesink will >>> throw away late frames. A smarter way might be to do: >>> >>> ... ! colorspace ! tee name = t ! queue leaky=upstream ! appsink >>> t. ! queue ! ximagesink >>> >>> This way you can use get the frames from appsink (better that using >>> pad-probes or fakesink with the handoff signal). Also the playback gets >>> not disturbed and you process the frames on appsink as you manage. All >>> other frames get dropped. >> Hey, I'm in the same situation, I want to get the frames, and I know I >> can manage the frame rate by using something videorate element, but >> that will drop frames. I want to process some stuff for every frame on >> the picture, so I need to slow down the frame rate playback sometimes, >> but without losing frames. I've seen a way to slow down the playback >> using gnonlin filesource element, but that doesn't convince me either. >> Is there other way ? >> > If you don't want to drop frames and just process frames as fast as you > can turn sync off on the sink. > > Stefan > _______________________________________________ > 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 |
On 10/16/2011 01:50 PM, Sami Pietilä wrote:
> Hi, > > How can I turn sync off on the sink? > > I tried: g_object_set (G_OBJECT (sink), "synchronous", false, NULL); c'mon. Does "gst-inspect ximagesink" show you a property called "synchronous". No! What about using the property called "sync" instead. Magic Stefan > Sink is "ximagesink". > > Frames are still being dropped. > > 2011/10/8 Stefan Sauer <[hidden email]>: >> On 10/07/2011 02:20 PM, Erick Pérez wrote: >>>>> I don't need to modify movie frames, but I need to read them and do >>>>> some calculations. Calculations might take some time, so I need a way >>>>> to control how gstreamers feeds the frames. That is, I need a way to >>>>> ask next frame from gstreamer instead of gstreamer feeding them at a >>>>> constant rate. >>>>> >>>>> How can I get a new frame only when requested? >>>> In your pad_probe just do the calculation as you need. ximagesink will >>>> throw away late frames. A smarter way might be to do: >>>> >>>> ... ! colorspace ! tee name = t ! queue leaky=upstream ! appsink >>>> t. ! queue ! ximagesink >>>> >>>> This way you can use get the frames from appsink (better that using >>>> pad-probes or fakesink with the handoff signal). Also the playback gets >>>> not disturbed and you process the frames on appsink as you manage. All >>>> other frames get dropped. >>> Hey, I'm in the same situation, I want to get the frames, and I know I >>> can manage the frame rate by using something videorate element, but >>> that will drop frames. I want to process some stuff for every frame on >>> the picture, so I need to slow down the frame rate playback sometimes, >>> but without losing frames. I've seen a way to slow down the playback >>> using gnonlin filesource element, but that doesn't convince me either. >>> Is there other way ? >>> >> If you don't want to drop frames and just process frames as fast as you >> can turn sync off on the sink. >> >> Stefan >> _______________________________________________ >> 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 _______________________________________________ gstreamer-devel mailing list [hidden email] http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel |
Hi,
I found the property value "synchronous" from documentation: http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-base-plugins/html/gst-plugins-base-plugins-ximagesink.html I don't quite understand the documentation, why doesn't it have "sync" listed? > c'mon. Does "gst-inspect ximagesink" show you a property called > "synchronous". No! What about using the property called "sync" instead. > Magic > > Stefan _______________________________________________ gstreamer-devel mailing list [hidden email] http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel |
On 10/17/2011 04:11 PM, Sami Pietilä wrote:
> Hi, > > I found the property value "synchronous" from documentation: > http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-base-plugins/html/gst-plugins-base-plugins-ximagesink.html oh my. This is confusing. I pushed a patch to make the purpose more clear. But as it already says - its only for debugging. Calls to the xserver will be synchronous instead of the default (async). This help to debug eventual problems talking to the XServer and identifying which call failed. > I don't quite understand the documentation, why doesn't it have "sync" listed? Because it comes from a super class (GstBaseSink). There is no way a static documentation can fix this :/ You need to traverse up the class hierarchy and check the super classes too. I wish this could be done better in the docs ... Stefan >> c'mon. Does "gst-inspect ximagesink" show you a property called >> "synchronous". No! What about using the property called "sync" instead. >> Magic >> >> Stefan > _______________________________________________ > 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 |
Free forum by Nabble | Edit this page |