'How to catch ffmpeg stream with OpenCV C API?
I would like to read an ffmpeg stream from OpenCV C API.
The streamer I want to catch is generate using ffmpeg -f avfoundation -i "1" -pix_fmt uyvy422 -f mpegts udp://192.168.1.110:5000
I try to read the stream with the following code
#include <opencv/cv.h>
#include <opencv/highgui.h>
#include <opencv2/videoio/videoio_c.h> //C API VideoCapture()
CvCapture* cap = cvCreateFileCaptureWithPreference("udp://192.168.1.110:5000", CV_CAP_FFMPEG);
cvGrabFrame(stream->cap);
IplImage* frame = cvRetrieveFrame(stream->cap, 0);
The problem is that frame is set to NULL and nothing is actually retrieved.
It will be straightforward using C++ API, but I cannot use it in my project, I need the C API.
Any idea on how to implement this?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
