HTTP live stream from OpenCV

asked 2014-11-17 21:15:09 -0600

fruitcup gravatar image

I am processing webcam input and modifying it with OpenCV. I would like to stream these modified frames to a web browser via HTTP.

I am currently using this basic code:

int main()
{
    cv::VideoCapture cap(0);

    while (true) {
        cv::Mat frame;
        cap.read(frame);

        if (!frame.empty()) {
            cv::imshow("Output", frame);
        }

        if (cv::waitKey(30) >= 0) {
            break;
        }
    }

    return 0;
}

But I am unsure of how to turn this into a video stream. I have looked into using ffmpeg to somehow stream it but I haven't been able to find any definitive solutions to what I'm looking for. How could I accomplish this?

edit retag flag offensive close merge delete