Coder Social home page Coder Social logo

Comments (17)

skvark avatar skvark commented on July 19, 2024 5

I might have figured out a way to include FFmpeg support to the Linux (and maybe MacOS too) builds without actually shipping the library itself within the package. This will of course require a proof of concept first, but this is roughly the idea:

1. Find somewhere a fresh dev build of FFmpeg for Cent OS 5 or compile it manually
2. Compile OpenCV against it
3. Patch the resulting binary with PatchELF which comes pre-installed in the manylinux containers
- this means that any needed link time dependencies (DT_NEEDED) related to FFmpeg will be removed
4. Users can install the opencv-python as before and it will import without any issues, BUT:
- video I/O is maybe (I have to look at this, not sure about the dynamic linker stuff) supported given that FFmpeg has been separately installed in the system and it is API/ABI compatible with the one that OpenCV was compiled against
- trying to use video related functions without FFmpeg will most likely result in undefined symbol / some other error and terminate the program

EDIT: I have been thinking about this and the solution above does not probably work correctly. However, the same logic could be applied to __init__.py if import fails -> remove DT_NEEDED (with python) entries from the binary and try again.

EDIT2: Forget all of the above. We will ship LGPL FFmpeg with the packages like in the Windows wheels. Work in progress.

It will take some time to test this, so do not except video support any time soon. I haven't forgotten this or the other issues :)

from opencv-python.

cachitas avatar cachitas commented on July 19, 2024 4

The Linux wheel built this way is useless to me then. A shame, for this could be an easy way to get OpenCV rolling in my environments. I have gstreamer also installed but it looks like it is of no help.

The lack of ffmpeg codecs could be the reason why I can not read my videos, but what about the camera? Any hints on how I can work through this?

Anyone using this on Linux with success? Can anyone cv2.VideoCapture(0) even without ffmpeg enabled?

from opencv-python.

skvark avatar skvark commented on July 19, 2024 2

FFmpeg will be supported in the next release. I will try to enable V4L2 also.

from opencv-python.

skvark avatar skvark commented on July 19, 2024 2

Some of the V4L/V4L2 headers were missing on those Cent OS 5 containers. I ended up adding them there manually since anything else didn't seem to work. OpenCV detects now both of them and builds fine. Can't really test if webcams work in reality since I don't have actual HW for testing but I guess we will see at some point.

from opencv-python.

skvark avatar skvark commented on July 19, 2024 1

I'm waiting for pull request for macOS support, see #49. For Linux builds FFmpeg will be added hopefully during this year.

from opencv-python.

espadolini avatar espadolini commented on July 19, 2024 1

How is V4L2 (using VideoCapture with webcams) related to FFmpeg in any way? The two are orthogonal (except maybe to support h264 webcams, which are somewhat rare anyway).

Is there a problem building with V4L2 support with the manylinux setup?

from opencv-python.

skvark avatar skvark commented on July 19, 2024

The Linux builds have been built without ffmpeg. I can enable it (and I'm looking into #6), but there remains the GPL/LGPL licensing issue. Statically linking the ffmpeg to the cv2.so is a no go (I don't know if this is even possible). Shipping the shared ffmpeg lib with the package might be possible. Another solution is to build the package with ffmpeg support and then users manually install ffmpeg on their systems.

from opencv-python.

cancan101 avatar cancan101 commented on July 19, 2024

Using the wheels built here, I cannot get capture devices to work on either OS X or Linux (Ubuntu).

from opencv-python.

cancan101 avatar cancan101 commented on July 19, 2024

It looks like windows support was added: #15

from opencv-python.

skvark avatar skvark commented on July 19, 2024

Haven't found yet enough time to enable ffmpeg on Linux/OS X. Yes, Windows support was a lot easier to add than for example Linux because precompiled ffmpeg shared libs are provided within OpenCV.

from opencv-python.

cancan101 avatar cancan101 commented on July 19, 2024

https://github.com/opencv/opencv/tree/master/3rdparty/ffmpeg talks about various options around ffmpeg, etc and dealing with licenses. It seems that at least on OS X, oepncv should link against AVFoundation.

It might also be worth looking at how brew builds opencv3: https://github.com/Homebrew/homebrew-science/blob/master/opencv3.rb

from opencv-python.

cancan101 avatar cancan101 commented on July 19, 2024

There is also some flag: WITH_AVFOUNDATION.

from opencv-python.

arthurbarros avatar arthurbarros commented on July 19, 2024

@skvark is it in progress? are there any rc with it already? Thanks m8

from opencv-python.

skvark avatar skvark commented on July 19, 2024

I haven't tried, but I hope it works. I'm just trying to provide consistent and comprehensive packages across different platforms given that Windows builds already use FFmpeg for video I/O and macOS builds will have FFmpeg support hopefully soon.

from opencv-python.

skvark avatar skvark commented on July 19, 2024

Closing in favor of #50 and #56.

from opencv-python.

fabito avatar fabito commented on July 19, 2024

As @kerio92 mentioned. We could have webcam video capture enabled without FFMPEG.
Its a totally separate flag and dependency to enable V4L2 support in OpenCV.

from opencv-python.

fabito avatar fabito commented on July 19, 2024

Once it's released I can help testing it.

from opencv-python.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.