Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error on OpenCV #35

Open
541380000 opened this issue Mar 18, 2018 · 1 comment
Open

Error on OpenCV #35

541380000 opened this issue Mar 18, 2018 · 1 comment

Comments

@541380000
Copy link

Dear author:
After successfully installing Pistreaming on my RaspiberryPi, I can now watch the video by 192.168.137.2:8082 in my browser.
But when I try to use it in the opencv, I failed to open the camera by
VideoCapture video; video.open(192.168.137.2:8082);
So how can I get the video in OpenCV?

@waveform80
Copy link
Owner

This is basically a duplicate of #26...

OpenCV usually relies on local V4L (Video4Linux) devices for video capture. This is a considerably different thing to an MPEG1 stream over a websocket (which is what pistreaming provides). I've no idea if OpenCV can open a network stream directly; it can open a file so there's a possibility it might work with something like a FIFO or a UNIX socket (through which the stream is re-directed), but if it wants to seek within the file that obviously won't work.

If you're looking to perform operations in OpenCV on the stream you're probably better off passing the unencoded frames from the camera straight to OpenCV within the script (with an option to drop frames if processing gets behind). The BroadcastOutput.write method is what receives unencoded frames (currently in YUV420 format, you may want BGR for OpenCV instead but be warned that will double the frame size and the ffmpeg sub-process will need adjusting accordingly). You could send the data from there through a queue to something else wanting to process it (don't try and do processing within the write method; it's expected to return fast as it's running within the camera's thread).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants