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

Luis Alberto Zarrabeitia zarrabeitia at gmail.com
Sun May 11 08:18:00 PDT 2014


Thank you, Tiago and Tim. Sorry for the delay---I didn't notice that
that my gstreamer-devel emails were being filtered from my inbox.

Yes! That was it. Opencv was compiled against 0.10:
--     GStreamer:
--       base:                      YES (ver 0.10.36)
--       app:                       YES (ver 0.10.36)
--       video:                     YES (ver 0.10.36)

Recompiling opencv without gstreamer support solved the issue. For the record:

cmake -DWITH_GSTREAMER=no ../opencv-2.4.9

Also, now that I know that opencv is compiled against gstreamer, I
found that it has a CvCapture_Gstreamer class that probably does what
I wanted to do. The only downside is that it uses the old interface;
the cv2 VideoCapture interface just tries the CvCapture_*
implementations sequentially. The best solution for me will probably
be to create a VideoCapture_Gstreamer that only tries gstreamer. (This
is offtopic for this list, just writing it here for future reference).

I was also going to ask for an example of frame by frame capture with
gst 0.10, but now I suspect that CvCapture_Gstreamer has all I need.

Thank you!

Luis.

On Sat, May 10, 2014 at 12:56 PM, Thiago Santos
<ts.santos at sisa.samsung.com> wrote:
> On 05/09/2014 09:09 PM, Luis Alberto Zarrabeitia wrote:
>
> 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.
>
> I just quickly tried your main.cpp tried with upstream gstreamer
> and it seems to work. So it might have been fixed in some newer
> version but I don't remember anything being fixed in this regard
> recently. What version are you using? Did you do anything unusual
> in your gstreamer setup?
>
> You can run your app in gdb with G_DEBUG=fatal_warnings
> and you will have it break on those assertions so you can check the
> backtrace to know where the error is coming from.
>
>
> Thanks,
>
> Luis
>
>
>
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>
>
>
> --
> Thiago Sousa Santos
> Senior Multimedia Engineer, Open Source Group
> Samsung Research America - Silicon Valley
>
>
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>


More information about the gstreamer-devel mailing list