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

Dirk Van Haerenborgh vhdirk at gmail.com
Wed May 14 00:47:36 PDT 2014


Hi,

This might be off-topic for the GStreamer list, but since I'm the author of
the GStreamer 1.0 port of the OpenCV backend (currently in git master), I'm
going to take the liberty :)

While it is true that cv::VideoCapture does use the old CvCapture_ C-style
interface, you can feed it gst-launch style pipelines that end with an
appsrc. If you feel that is too clumsy, cap_gstreamer.cpp has everything
you need to read the stream frame by frame.

Also, the GStreamer OpenCV backend will default to GStreamer 1.0, unless
otherwise specified (WITH_GSTREAMER_0_10).

Cheers,
-Dirk







On 11 May 2014 17:18, Luis Alberto Zarrabeitia <zarrabeitia at gmail.com>wrote:

> 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
> >
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20140514/59071d89/attachment.html>


More information about the gstreamer-devel mailing list