-
Notifications
You must be signed in to change notification settings - Fork 220
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
OpenCV video capture from file fails on Linux #121
Comments
Update: tested with Anaconda-2.0.0-Linux-x86_64 on Ubuntu 14.04LTS, same problem. |
Small video file that can be used to test this: http://techslides.com/demos/sample-videos/small.mp4 |
I met the same issue and couldn't solve. |
This is a workaround rather than a solution, but it does help: install scikit-video (for example with pip install scikit-video) and either avconv or ffmpeg, then use skvideo.io.VideoCapture in place of cv2.VideoCapture.
API is a drop-in replacement. |
The opencv installed from binstar may be compiled with |
I've compiled OpenCV 3 on 14.04 with
(I suspect the root problem might be that Ubuntu moved from ffmpeg to libav in 14.04, but that should be qualified by the fact that I know nothing about the OpenCV internals) |
Still a problem in Anaconda-2.1.0-Linux-x86_64 (Ubuntu 14.04 LTS) |
Still a problem in Conda 3.12.0. |
Any plans on fix? |
Thanks @aizvorski and @andyljones, that worked! Will have to do until an official fix comes around. |
@Strateus This is not quite the oldest open Anaconda issue, but it is getting there. Btw, I am told this works on at least some Linux distros which are not related to Debian, for example Arch. On Debian and Ubuntu (and friends) it still doesn't work, a year and a half later. Continuum guys, can you please tag this as a bug? It is confirmed by a bunch of people already, and there is a simple way to reproduce it. |
Same here; running .mp4 and .avi files and it didn't work. Latest versions of anaconda, opencv3, and python3 as of this post. |
same problem here. |
I got ffmpeg working by following instruction on this website: https://github.com/menpo/conda-opencv Rebuild the opencv with -DWITH_FFMPEG = 1 in build.sh. It should work. |
Still an issue |
Still an issue.. Any permanent solution guys? |
Facing the same issue . . |
Removing opencv from Anaconda, and using cv.py which OpenCV generated while it was compiled worked for me. |
Same problem here... thanks @aizvorski for the workaround |
@gyifan ,where is DWITH_FFMPEG = 1 in build.sh???thank you! |
The issue here is that the Anaconda opencv package is not compiled with ffmpeg support currently. ffmpeg is difficult to support across platforms. If anyone is interested in commercially sponsoring this support in Anaconda, we can rebuild opencv so that it supports ffmpeg. Please contact sales@continuum.io |
@msarahan hello, if i want to use opencv capture video ,which package i can use? thank you!! |
Same problem using Python 3.5.2, Anaconda 4.2.0 (64-bit), OpenCV 3.1.0 installed with conda install -c menpo opencv3=3.1.0. We don't have the workaround from @aizvorski and @andyljones anymore! VideoCapture was dropped in their video API and also the package was substituted for sk-video instead of scikit-video. You should do: If you use this on current scikit-video you get an error:
|
I'm also having the same problem. installed opencv using[ conda install -c menpo opencv3=3.1.0 ] any solution for this? |
I've tried a rather simple way and fixed this problem. |
Kratzert's method works fine for me. I am not using annocoda. My linux version is 16.04. Wish this helps. https://github.com/kratzert/Ubuntu_from_scratch/blob/master/Ubuntu_16_04LTS.md#installing-opencv3 |
@kratzert your method works for me, thanks a lot. I'm using anaconda3 in Ubuntu 16.04. In the cmake step, remember to replace USER with your username, and replace miniconda3 with anaconda3 if you use anaconda3. |
any updates on this? its causing me a lot of trouble. on ubuntu, cant read avi with opencv |
There years has passed, and I have same issue. anaconda 4.3.29, python3.6.3 |
Please try the latest builds of OpenCV, version 3.3.1, which were released last week. These were build with ffmpeg and should be able to read video from a file. |
@jjhelmus OpenCV 3.3.1 is currently not available in pip |
@khanh96le We do not publish packages on pip, please use conda to install OpenCV. |
@jjhelmus How can I select opencv package installed by conda instead of opencv installed by pip?
And when I import cv2 and check version, it's still 3.3.0
|
Only a single OpenCV package should be installed in an environment, installing from both pip and conda will likely result in one package overwriting the other. My suggestions would be to uninstall both OpenCV installs using |
@jjhelmus I installed opencv using : conda install opencv. I got this error: OpenCV Error: Unspecified error (The function is not implemented. Rebuild the library with Windows, GTK+ 2.x or Carbon support. If you are on Ubuntu or Debian, install libgtk2.0-dev and pkg-config, then re-run cmake or configure script) in cvShowImage, file /tmp/build/80754af9/opencv_1512687413662/work/modules/highgui/src/window.cpp, line 611 there is something wrong with cv2.imshow. would you please help me fix it? |
@hanikh Our OpenCV package does not include GTK support so |
@jjhelmus I'm so supprised when you said |
I am facing the same issue when reading |
You may try to install opencv from source.
…On Sat, Feb 24, 2018 at 8:57 PM, Jai Shah ***@***.***> wrote:
I am facing the same issue when reading .avi files.... cv2.VideoCapture
fails reading the video
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#121 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AYG_oNQr9KS7xGmqcyVMcb_xgbOUDRt9ks5tYOhBgaJpZM4B-PoQ>
.
--
Bin Wang
Ph.D. Student
Signal and Image Processing Institute
Graduate Student in Electrical Engineering
University of Southern California
|
installing opencv with 'pip3 install opencv-python' works for me |
Still an issue |
We will not be providing h264 or h265 support for licensing reasons. That is the issue here. |
Finally worked.. Used the solution mentioned by @WystanDeng . As mentioned here: [Link] conda install -c anaconda opencv Using Ubuntu 16.04 and Anaconda2-5.2.0-Linux-x86_64.sh |
I have the same issue with opencv VideoCapture, and tried all the mentioned solutions here. None worked for me so far. Did someone find a better way to solve this issue? Using skvideo.io.VideCapture I get the following error: module 'skvideo.io' has no attribute 'VideoCapture'. I could not solve this either. |
Facing the same issue, were you able to resolve this? |
The following fails on Anaconda 1.9 on Linux only:
Tested with Anaconda-1.9.2-Linux-x86_64 on Ubuntu 12.04LTS, Debian Wheezy. The same code using the same input file works in Anaconda on Windows 7, and also using the python-opencv 2.3.1-7 package (and stock python) on Ubuntu. The input file is H.264 video in a MP4 container. Anaconda is installed system-wide under /opt/anaconda, and /opt/anaconda/bin is in the path.
It's not just one particular file: I've tried many video files, none work on Linux (including different containers avi ts mp4, and different codecs H.264 DIVX etc). Writing files also fails.
Is there a trick to getting Anaconda cv2 video read/write fully working on Linux?
The text was updated successfully, but these errors were encountered: