How to write OpenCV frames into Gstreamer pipeline?
Kevron Rees
tripzero.kev at gmail.com
Thu Jan 14 11:05:58 PST 2016
You probably want an opencv filter similar to
https://github.com/tripzero/opencvfilter/blob/master/opencvfilter.py
On Wed, Jan 13, 2016 at 8:35 PM Zheng <superxingzheng at gmail.com> wrote:
> I want to stream video which is processed by opencv through network. I have
> working codes capturing frames from gstreamer appsink using opencv's
> VideoCapture with Gstreamer enabled when building opencv.
> But writing opencv Mat frames into gst pipeline seems to be tricky.
> Here is a piece of code to show you what I want to do. I hope some one who
> has similar experiences can give me some hint. Thanks in advance!
>
> #include <iostream>
> #include <iomanip>
> #include <opencv2/opencv.hpp>
>
> using namespace std;
> using namespace cv;
>
> int main(int argc, char** argv) {
> /*
> * TODO: figure out a working pipeline.
> */
> string test_pipe = "appsrc ! autovideosink";
>
> VideoCapture cap(0);
> if (!cap.isOpened())
> return -1;
> Mat frame;
>
> VideoWriter writer(test_pipe, VideoWriter::fourcc('Y', 'U', 'Y',
> 'V'),
> 30.0, Size(640, 480), true);
> if (!writer.isOpened())
> return -1;
>
> //namedWindow("test", 1);
> double t = 0.0;
> while(1) {
> t = (double)getTickCount();
> cap >> frame;
>
> // TODO: do some process here
>
> writer << frame;
> //imshow("test", frame);
> if (waitKey(1) == 27)
> break;
> t = ((double)getTickCount() - t) / getTickFrequency(); //
> in millisecond.
> cout << "Frame Rate = " << setw(8) << 1.0 / t << " fps" <<
> '\r';
> }
> return 0;
> }
>
>
>
>
> --
> View this message in context:
> http://gstreamer-devel.966125.n4.nabble.com/How-to-write-OpenCV-frames-into-Gstreamer-pipeline-tp4675258.html
> Sent from the GStreamer-devel mailing list archive at Nabble.com.
> _______________________________________________
> 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/20160114/dab54b9c/attachment-0001.html>
More information about the gstreamer-devel
mailing list