My current OpenCV version is 2.4.13. Python version is 2.7.11. My operating system is OS X Yosemite 10.10.5. I've been trying to use VideoCapture() to read url but keep getting this:
WARNING: Couldn't read movie file
VideoCapture() works fine with my laptop's webcam and local files. For example, I can open and play video like this:
cv2.VideoCapture("sg04video.mov")
But I am trying to access my ip camera with OpenCV. At first I thought I had the wrong url or it was some authentication problem. I disabled authentication, tried several camera urls(both rtsp and http) and could open them in VLC player. VLC player can also open other resources like this one: random rtsp video link
I even managed to open the url for capturing camera view image in my browser.
But cv2.VideoCapture cant open any of those urls, both video and image, whether its for my own camera or from the internet. Im sure the problem is not with the ip camera.
I am relatively new to programming and I installed OpenCV following this guide:
Installing OpenCV 2.4.9 on Mac OSX with Python Support
Please help!! Thanks!
Related
I have a program that is a face recognition application and I want to run it on a PC client.
But it shows an error like this
I think it might be that the program cannot connect to any camera device in my client ,
in my python code i use this
cap=cv2.VideoCapture(0)
and i have install logitech camera driver in my client pc
but it is still can not detect any camera in my client
how can i solve this?
I've had this issue before and what solved it for me was using a different USB port on the PC for the webcam. It was due to the driver being connected to certain ports that opencv read from.
I got a problem with open cv real-time video capturing from camera. I have tried many solutions/suggestions which are available out there but not working for me. Following are the problems:
cap = cv2.VideoCapture(0)
when I tried to get video with this following error comes up:
[ WARN:0] VIDEOIO ERROR: V4L: can't open camera by index 0
Could not open video device
<VideoCapture 0x7fd99e6b5330>
Even though it is reading the video reference.
And from one solution by https://github.com/skvark/opencv-python/issues/124 I tried with
cap = cv2.VideoCapture(-1)
But this does not worked for me as it gives the error:
Video device not found
By trying sudo modprobe bcm2835-v4l2 command I got modprobe: FATAL: Module bcm2835-v4l2 not found in directory /lib/modules/4.15.0-66-generic this error. I'm not finding a way to get out of it.
It is working fine on my MacBook locally but when I tried to deploy on Ubuntu server I'm facing these errors in loop. Can anyone help me on it? Thanks in advance.
Can you open your webcam through other apps?
If not firslty try to reinstall webcam driver.
if you can do it, either some app is using webcam so cv2 can't get access to it or you did not install 3rdparty libraries to work with cameras/videos. You need to install them properly before building OpenCV Python bindings.
( you can find some info there: https://github.com/opencv/opencv/issues/8471 )
Following is the response from hosting server:
"The directory video0 would not exist because our droplets do not have any peripherals attached to them. The function cv2.VideoCapture() attempts to obtain the video capture from a webcam which a droplet would not have.
If you are wanting to stream a remote feed you should be able to do this via RTSP:
https://stackoverflow.com/questions/29099839/opencv-stream-from-a-camera-connected-to-a-remote-machine"
The problem is with droplet which don't have that functionality which we are trying to achieve.
Thanks to all for your love, support and help. Really appreciated. It might help someone else as well.
I am trying to use Python OpenCV on a Windows Ubuntu terminal for a research project. However, when I try to open my camera to capture video I get VIDEOIO ERROR: V4L: can't find camera device. How can I access my camera using OpenCV?
I tried to use v4l2-ctl --list-devices and I get Failed to open /dev/video0: No such file or directory. The camera on my computer works when using the camera application.
I am using the following cv2 command to grab the video capture device.
import cv2
stream = cv2.VideoCapture(-1)
Ubuntu for Windows is based on Windows Subsystem for Linux (WSL). WSL does not provide hardware support so it can't provide you with a driver for your camera. See this question as well.
I am using zbar python library on Raspberry Pi3 for scanning QR code.
I have USB camera mounted on /dev/video0.
I want to control camera resolution.
(Reduce resolution to improve performance)
I am not able to find any interface for same.
I have tried using request_size but getting below error:
zbar.Processor() object has no attribute 'request_size'
Edit:
I am using process_one method.
Edit2:
Below is my code:
I am trying to figure out how to play an mp3 that exists on my server served through HTTP. I tried to figure out pyglet but there were too many issues with AVBin to make that work (something about dividing by zero in the source code). So, I decided to try PyAudio, but I can't figure out how to stream an mp3 source from HTTP with it. All the examples are wav files and I need examples rather than the docs or I'm afraid I'll have to figure out the particulars of how audio works on the lowest level. All the documentation is confusing for those of us that don't know the lingo (sample rate, etc). Can anyone help?
What is your source and target server environments? [ windows / linux / mac? ]. Also are your trying to play an audio file or video?
In either case you can use Gstreamer with python. I've windows laptop, so I tried with Gstreamer 1.0.x from here
Online examples are for Gstreamer 0.10 that does not work with newer Gstreamer 1.0. There lots of modifications that are platform specific.
However, on windows Gstreamer comes with gst-launch binary which works off the shelf. [ For Linux there is equivalent binary ]
Setup
Server Side:
On server side, you need to setup HTTP server. Without knowing specifics of your environment I can say that there are various solutions available , including python http server SimpleHTTPServer.
See solution here
Client Side :
Once http server is installed and running, on your laptop, you can simply run
C:\Python27\Lib\site-packages\gnome> .\gst-launch.exe playbin uri = http://www.freesound.org/data/previews/148/1482641337920-lq.mp3
Replace http server address with your server address and port.
You can call gst-launch in your python script and go creative with it.
OutPut:
I've opened audio files from freesound.org successfully. It should open a audio file being served from your http server as well.