简体   繁体   中英

Import Gstreamer video in Qt+Opencv

I use gstreamer for streaming my webcam over wireless network I use a Arm board for streaming and receive in my pc. want to import the video received in qt for using with opencv.

stream the video using this command:

./capture -c 10000 -o | gst-launch-0.10 -v -e filesrc location=/dev/fd/0 ! h264parse ! rtph264pay ! tcpserversink host=127.0.0.1 port=8080

and for receive:

gst-launch udpsrc port=1234 ! "application/x-rtp, payload=127" ! rtph264depay ! ffdec_h264 ! xvimagesink sync=false

what should i do for using received video in qt. i want to use for image processing.

You need to write your own application for receiving instead of using gst-launch. For that refer to the documentation at gstreamer.freedesktop.org. Specially the application development manual http://gstreamer.freedesktop.org/data/doc/gstreamer/head/manual/html/index.html

For using the video inside a Qt window you can use the GstXOverlay/GstVideoOverlay interface to tell xvimagesink where to draw the video (the window id).

There is an opencv plugin in gstreamer that wraps a few function/filters from opencv. If the function of your interest isn't implemented you can wrap it in a new gstreamer element for using it. Or you can write a buffer probe to modify the buffers from your application and do the processing calling opencv yourself.

From your gst-launch lines I can see that you are using version 0.10. If possible you should consider moving to 1.x versions as 0.10 is obsolete and unmantained. If you must stick to 0.10, pay attention when looking for the doc to make sure you are reading the correct documentation for your version.

The best solution is to use QtGstreamer in order to capture and stream videos using gstreamer in a Qt environment. The main advantage is that you could insert your pipeline description into a String and the library will do the hard coding for you. You'll avoid to code all the pipeline components by yourself. However you will have to code your own sink to use the captured frames with OpenCV. http://gstreamer.freedesktop.org/data/doc/gstreamer/head/qt-gstreamer/html/index.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM