gstreamer-1.0 and opencv, is it broken? (or is it me?)

Luis Alberto Zarrabeitia zarrabeitia at gmail.com
Fri May 9 17:09:52 PDT 2014


I'm trying to use gstreamer to read a video file for processing in
opencv (opencv fails to read it, gstreamer works perfectly). However,
it seems there is a problem, at least in my system, if I try to use
the opencv UI functions (so far, cv::namedWindow and cv::waitKey),
subsequent gstreamer calls fail. They work with gstreamer-0.10, but
not with 1.0, which leads me to think the problem is in the gstreamer
side or in my local insallation. Or maybe I missed a difference
between 0.10 and 1.0.

I'm attaching an minimalist example. I added one opencv call to the
basic tutorial 1. Compiling & running it with gstreamer 1.0:

$ g++ main.cpp `pkg-config --cflags --libs opencv gstreamer-1.0`

fails with

$ ./a.out
(video:28781): GLib-GObject-WARNING **: cannot register existing type
`GstObject'
(video:28781): GLib-CRITICAL **: g_once_init_leave: assertion `result
!= 0' failed
(video:28781): GLib-GObject-CRITICAL **: g_type_register_static:
assertion `parent_type > 0' failed
(video:28781): GLib-CRITICAL **: g_once_init_leave: assertion `result
!= 0' failed
(video:28781): GStreamer-CRITICAL **:
gst_pad_set_activatepush_function: assertion `GST_IS_PAD (pad)' failed
[it gets stuck here, attaching the GST_DEBUG=4 output]

Compiling with 0.10

$ g++ main.cpp `pkg-config --cflags --libs opencv gstreamer-0.10`

it works perfectly. It also works perfectly with both versions if I
comment out the cv::namedWindow line.

Any idea of how can I work around that? I just need to be able to
connect an appsink to the pipeline, or an analogous way to extract
frames, to feed them to my existing program. So far, even connecting
the video and audio to a fakesink results in the same error.

Thanks,

Luis
-------------- next part --------------
0:00:00.000106841 29001       0x7d9d00 INFO                GST_INIT gst.c:568:init_pre: Initializing GStreamer Core Library version 1.0.6
0:00:00.000145338 29001       0x7d9d00 INFO                GST_INIT gst.c:569:init_pre: Using library installed in /usr/lib/x86_64-linux-gnu
0:00:00.000154878 29001       0x7d9d00 INFO                GST_INIT gst.c:579:init_pre: Linux imladris 3.8.0-19-generic #29-Ubuntu SMP Wed Apr 17 18:16:28 UTC 2013 x86_64
0:00:00.000713849 29001       0x7d9d00 INFO                GST_INIT gstmessage.c:121:_priv_gst_message_initialize: init messages
0:00:00.001092107 29001       0x7d9d00 INFO      GST_PLUGIN_LOADING gstplugin.c:317:_priv_gst_plugin_initialize: registering 0 static plugins
0:00:00.001186682 29001       0x7d9d00 INFO      GST_PLUGIN_LOADING gstplugin.c:225:gst_plugin_register_static: registered static plugin "staticelements"
0:00:00.001196238 29001       0x7d9d00 INFO      GST_PLUGIN_LOADING gstplugin.c:227:gst_plugin_register_static: added static plugin "staticelements", result: 1
0:00:00.001209958 29001       0x7d9d00 INFO            GST_REGISTRY gstregistry.c:1680:ensure_current_registry: reading registry cache: /home/kyrie/.cache/gstreamer-1.0/registry.x86_64.bin
0:00:00.015748896 29001       0x7d9d00 INFO            GST_REGISTRY gstregistrybinary.c:617:priv_gst_registry_binary_read_cache: loaded /home/kyrie/.cache/gstreamer-1.0/registry.x86_64.bin in 0.014525 seconds
0:00:00.015811442 29001       0x7d9d00 INFO            GST_REGISTRY gstregistry.c:1539:scan_and_update_registry: Validating plugins from registry cache: /home/kyrie/.cache/gstreamer-1.0/registry.x86_64.bin
0:00:00.016531366 29001       0x7d9d00 INFO            GST_REGISTRY gstregistry.c:1638:scan_and_update_registry: Registry cache has not changed
0:00:00.016550327 29001       0x7d9d00 INFO            GST_REGISTRY gstregistry.c:1715:ensure_current_registry: registry reading and updating done, result = 1
0:00:00.016562332 29001       0x7d9d00 INFO                GST_INIT gst.c:769:init_post: GLib runtime version: 2.36.0
0:00:00.016573158 29001       0x7d9d00 INFO                GST_INIT gst.c:771:init_post: GLib headers version: 2.36.0
0:00:00.016585387 29001       0x7d9d00 INFO                GST_INIT gst.c:419:gst_init_check: initialized GStreamer successfully
0:00:00.016596785 29001       0x7d9d00 INFO            GST_PIPELINE gstparse.c:322:gst_parse_launch_full: parsing pipeline description 'playbin uri=http://docs.gstreamer.com/media/sintel_trailer-480p.webm'
0:00:00.018037860 29001       0x7d9d00 INFO      GST_PLUGIN_LOADING gstplugin.c:830:gst_plugin_load_file: plugin "/usr/lib/x86_64-linux-gnu/gstreamer-1.0/libgstplayback.so" loaded
0:00:00.018062219 29001       0x7d9d00 INFO     GST_ELEMENT_FACTORY gstelementfactory.c:365:gst_element_factory_create: creating element "playbin"
0:00:00.018525346 29001       0x7d9d00 INFO              GST_STATES gstbin.c:2194:gst_bin_element_set_state:<playsink> current NULL pending VOID_PENDING, desired next READY
0:00:00.018548178 29001       0x7d9d00 INFO              GST_STATES gstbin.c:2194:gst_bin_element_set_state:<streamsynchronizer0> current NULL pending VOID_PENDING, desired next READY
0:00:00.018562727 29001       0x7d9d00 INFO              GST_STATES gstelement.c:2321:gst_element_continue_state:<streamsynchronizer0> completed state change to READY
0:00:00.018574093 29001       0x7d9d00 INFO              GST_STATES gstelement.c:2226:_priv_gst_element_state_changed:<streamsynchronizer0> notifying about state-changed NULL to READY (VOID_PENDING pending)
0:00:00.018605247 29001       0x7d9d00 INFO              GST_STATES gstbin.c:2602:gst_bin_change_state_func:<playsink> child 'streamsynchronizer0' changed state to 2(READY) successfully
0:00:00.018621098 29001       0x7d9d00 INFO              GST_STATES gstelement.c:2321:gst_element_continue_state:<playsink> completed state change to READY
0:00:00.018631555 29001       0x7d9d00 INFO              GST_STATES gstelement.c:2226:_priv_gst_element_state_changed:<playsink> notifying about state-changed NULL to READY (VOID_PENDING pending)
0:00:00.018645141 29001       0x7d9d00 INFO              GST_STATES gstbin.c:2602:gst_bin_change_state_func:<playbin0> child 'playsink' changed state to 2(READY) successfully
0:00:00.018657918 29001       0x7d9d00 INFO              GST_STATES gstelement.c:2296:gst_element_continue_state:<playbin0> committing state from NULL to READY, pending PLAYING, next PAUSED
0:00:00.018668853 29001       0x7d9d00 INFO              GST_STATES gstelement.c:2226:_priv_gst_element_state_changed:<playbin0> notifying about state-changed NULL to READY (PLAYING pending)
0:00:00.018681275 29001       0x7d9d00 INFO              GST_STATES gstelement.c:2303:gst_element_continue_state:<playbin0> continue state change READY to PAUSED, final PLAYING
0:00:00.018694717 29001       0x7d9d00 INFO     GST_ELEMENT_FACTORY gstelementfactory.c:365:gst_element_factory_create: creating element "uridecodebin"
0:00:00.018836252 29001       0x7d9d00 INFO              GST_STATES gstelement.c:2321:gst_element_continue_state:<uridecodebin0> completed state change to READY
0:00:00.018849099 29001       0x7d9d00 INFO              GST_STATES gstelement.c:2226:_priv_gst_element_state_changed:<uridecodebin0> notifying about state-changed NULL to READY (VOID_PENDING pending)
0:00:00.018870149 29001       0x7d9d00 INFO              GST_STATES gstbin.c:2194:gst_bin_element_set_state:<playsink> current READY pending VOID_PENDING, desired next PAUSED
0:00:00.018883684 29001       0x7d9d00 INFO                playsink gstplaysink.c:1277:do_async_start:<playsink> Sending async_start message
0:00:00.018900385 29001       0x7d9d00 INFO              GST_STATES gstbin.c:2194:gst_bin_element_set_state:<streamsynchronizer0> current READY pending VOID_PENDING, desired next PAUSED
0:00:00.018914126 29001       0x7d9d00 INFO              GST_STATES gstelement.c:2321:gst_element_continue_state:<streamsynchronizer0> completed state change to PAUSED
0:00:00.018924437 29001       0x7d9d00 INFO              GST_STATES gstelement.c:2226:_priv_gst_element_state_changed:<streamsynchronizer0> notifying about state-changed READY to PAUSED (VOID_PENDING pending)
0:00:00.018937623 29001       0x7d9d00 INFO              GST_STATES gstbin.c:2602:gst_bin_change_state_func:<playsink> child 'streamsynchronizer0' changed state to 3(PAUSED) successfully
0:00:00.018951220 29001       0x7d9d00 INFO              GST_STATES gstbin.c:2608:gst_bin_change_state_func:<playbin0> child 'playsink' is changing state asynchronously to PAUSED
0:00:00.018963409 29001       0x7d9d00 INFO              GST_STATES gstbin.c:2194:gst_bin_element_set_state:<uridecodebin0> current READY pending VOID_PENDING, desired next PAUSED
0:00:00.020906539 29001       0x7d9d00 INFO      GST_PLUGIN_LOADING gstplugin.c:830:gst_plugin_load_file: plugin "/usr/lib/x86_64-linux-gnu/gstreamer-1.0/libgstsouphttpsrc.so" loaded
0:00:00.020929132 29001       0x7d9d00 INFO     GST_ELEMENT_FACTORY gstelementfactory.c:363:gst_element_factory_create: creating element "souphttpsrc" named "source"

(video:29001): GLib-GObject-WARNING **: cannot register existing type `GstObject'

(video:29001): GLib-CRITICAL **: g_once_init_leave: assertion `result != 0' failed

(video:29001): GLib-GObject-CRITICAL **: g_type_register_static: assertion `parent_type > 0' failed

(video:29001): GLib-CRITICAL **: g_once_init_leave: assertion `result != 0' failed

(video:29001): GStreamer-CRITICAL **: gst_pad_set_activatepush_function: assertion `GST_IS_PAD (pad)' failed

-------------- next part --------------
A non-text attachment was scrubbed...
Name: main.cpp
Type: text/x-c++src
Size: 333 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20140509/df1fc1d6/attachment.cpp>


More information about the gstreamer-devel mailing list