<div dir="ltr">Hi,<div><br></div><div>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 :)</div>

<div><br></div><div>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.<br>

</div><div><br></div><div>Also, the GStreamer OpenCV backend will default to GStreamer 1.0, unless otherwise specified (WITH_GSTREAMER_0_10).</div><div><br></div><div>Cheers,</div><div>-Dirk</div><div><br></div><div><br>
</div>
<div><br></div><div><br></div><div><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On 11 May 2014 17:18, Luis Alberto Zarrabeitia <span dir="ltr"><<a href="mailto:zarrabeitia@gmail.com" target="_blank">zarrabeitia@gmail.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Thank you, Tiago and Tim. Sorry for the delay---I didn't notice that<br>
that my gstreamer-devel emails were being filtered from my inbox.<br>
<br>
Yes! That was it. Opencv was compiled against 0.10:<br>
--     GStreamer:<br>
--       base:                      YES (ver 0.10.36)<br>
--       app:                       YES (ver 0.10.36)<br>
--       video:                     YES (ver 0.10.36)<br>
<br>
Recompiling opencv without gstreamer support solved the issue. For the record:<br>
<br>
cmake -DWITH_GSTREAMER=no ../opencv-2.4.9<br>
<br>
Also, now that I know that opencv is compiled against gstreamer, I<br>
found that it has a CvCapture_Gstreamer class that probably does what<br>
I wanted to do. The only downside is that it uses the old interface;<br>
the cv2 VideoCapture interface just tries the CvCapture_*<br>
implementations sequentially. The best solution for me will probably<br>
be to create a VideoCapture_Gstreamer that only tries gstreamer. (This<br>
is offtopic for this list, just writing it here for future reference).<br>
<br>
I was also going to ask for an example of frame by frame capture with<br>
gst 0.10, but now I suspect that CvCapture_Gstreamer has all I need.<br>
<br>
Thank you!<br>
<span class="HOEnZb"><font color="#888888"><br>
Luis.<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
On Sat, May 10, 2014 at 12:56 PM, Thiago Santos<br>
<<a href="mailto:ts.santos@sisa.samsung.com">ts.santos@sisa.samsung.com</a>> wrote:<br>
> On 05/09/2014 09:09 PM, Luis Alberto Zarrabeitia wrote:<br>
><br>
> I'm trying to use gstreamer to read a video file for processing in<br>
> opencv (opencv fails to read it, gstreamer works perfectly). However,<br>
> it seems there is a problem, at least in my system, if I try to use<br>
> the opencv UI functions (so far, cv::namedWindow and cv::waitKey),<br>
> subsequent gstreamer calls fail. They work with gstreamer-0.10, but<br>
> not with 1.0, which leads me to think the problem is in the gstreamer<br>
> side or in my local insallation. Or maybe I missed a difference<br>
> between 0.10 and 1.0.<br>
><br>
> I'm attaching an minimalist example. I added one opencv call to the<br>
> basic tutorial 1. Compiling & running it with gstreamer 1.0:<br>
><br>
> $ g++ main.cpp `pkg-config --cflags --libs opencv gstreamer-1.0`<br>
><br>
> fails with<br>
><br>
> $ ./a.out<br>
> (video:28781): GLib-GObject-WARNING **: cannot register existing type<br>
> `GstObject'<br>
> (video:28781): GLib-CRITICAL **: g_once_init_leave: assertion `result<br>
> != 0' failed<br>
> (video:28781): GLib-GObject-CRITICAL **: g_type_register_static:<br>
> assertion `parent_type > 0' failed<br>
> (video:28781): GLib-CRITICAL **: g_once_init_leave: assertion `result<br>
> != 0' failed<br>
> (video:28781): GStreamer-CRITICAL **:<br>
> gst_pad_set_activatepush_function: assertion `GST_IS_PAD (pad)' failed<br>
> [it gets stuck here, attaching the GST_DEBUG=4 output]<br>
><br>
> Compiling with 0.10<br>
><br>
> $ g++ main.cpp `pkg-config --cflags --libs opencv gstreamer-0.10`<br>
><br>
> it works perfectly. It also works perfectly with both versions if I<br>
> comment out the cv::namedWindow line.<br>
><br>
> Any idea of how can I work around that? I just need to be able to<br>
> connect an appsink to the pipeline, or an analogous way to extract<br>
> frames, to feed them to my existing program. So far, even connecting<br>
> the video and audio to a fakesink results in the same error.<br>
><br>
> I just quickly tried your main.cpp tried with upstream gstreamer<br>
> and it seems to work. So it might have been fixed in some newer<br>
> version but I don't remember anything being fixed in this regard<br>
> recently. What version are you using? Did you do anything unusual<br>
> in your gstreamer setup?<br>
><br>
> You can run your app in gdb with G_DEBUG=fatal_warnings<br>
> and you will have it break on those assertions so you can check the<br>
> backtrace to know where the error is coming from.<br>
><br>
><br>
> Thanks,<br>
><br>
> Luis<br>
><br>
><br>
><br>
> _______________________________________________<br>
> gstreamer-devel mailing list<br>
> <a href="mailto:gstreamer-devel@lists.freedesktop.org">gstreamer-devel@lists.freedesktop.org</a><br>
> <a href="http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel" target="_blank">http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel</a><br>
><br>
><br>
><br>
> --<br>
> Thiago Sousa Santos<br>
> Senior Multimedia Engineer, Open Source Group<br>
> Samsung Research America - Silicon Valley<br>
><br>
><br>
> _______________________________________________<br>
> gstreamer-devel mailing list<br>
> <a href="mailto:gstreamer-devel@lists.freedesktop.org">gstreamer-devel@lists.freedesktop.org</a><br>
> <a href="http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel" target="_blank">http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel</a><br>
><br>
_______________________________________________<br>
gstreamer-devel mailing list<br>
<a href="mailto:gstreamer-devel@lists.freedesktop.org">gstreamer-devel@lists.freedesktop.org</a><br>
<a href="http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel" target="_blank">http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel</a><br>
</div></div></blockquote></div><br></div>