opencv-python icon indicating copy to clipboard operation
opencv-python copied to clipboard

[Suggestions] Add a gpl binaries of opencv-python include ffmpeg x264, x265

Open talregev opened this issue 4 years ago • 9 comments

Add a gpl binaries of opencv-python include ffmpeg x264, x265.

talregev avatar Apr 23 '21 19:04 talregev

I was able to create a opencv python binding with static build with ffmpeg[x264,x265] with vcpkg. Is it something that interesting you? Will you consider to ship such a binary?

talregev avatar Apr 29 '21 19:04 talregev

@sergregory Fox linux I can create a docker file that will generate this python build. How you generate python build for windows? with a script? If yes, I can take this script and modify it that it will generate the gpl ffmpeg with x264,x265 and more features that you might want. Can we chat about this?

talregev avatar Apr 29 '21 19:04 talregev

Enabling FFmpeg GPL extensions can be very easily done by just changing the build settings in the Dockerfiles and macOS build scripts in this repository or just by building locally against local FFmpeg. For example:

  • https://github.com/opencv/opencv-python/blob/master/docker/manylinux2014/Dockerfile_x86_64#L52
  • https://github.com/opencv/opencv-python/blob/master/travis_config.sh#L68

On Windows, OpenCV CMake scripts download the pre-built FFmpeg binary during the build. We do not generate the binary here.

For local builds, just follow the instructions in the README (FFmpeg should be picked up automatically from your computer by the CMake scripts): https://github.com/opencv/opencv-python#manual-builds

About creating new binary distributions for this purpose... In my opinion, it's too risky to distribute compiled binaries containing x264 and x265 encoders. IANAL, but I believe that x264 and x265 include algorithms that are subject to software patents. That's why the Windows FFmpeg downloaded by CMake during Windows builds is LGPL and the h264 encoder must be downloaded separately by the user: https://github.com/opencv/opencv/blob/master/3rdparty/ffmpeg/readme.txt

However, this is just my opinion. I'm not the main maintainer of this project anymore so it's up to the OpenCV team to decide how they would like to proceed with this and possibly seek legal advice, if needed.

skvark avatar Apr 29 '21 20:04 skvark

Not sure why is risky. Yes I know the license for this binary (wheel) file will be change. The x264 and x265 are gpl, and if opencv will ship this binaries they will be gpl. What I am suggesting that you will continue to give lgpl binaries and in addition opencv can ship binaries that gpl license. Can you mentione the relevant person that can make such a decision? Thank you for your comment.

talregev avatar Apr 29 '21 20:04 talregev

If you read my comment, the issue is not GPL but patents. Read the legal info about FFmpeg here: https://www.ffmpeg.org/legal.html

I'm sure someone from the OpenCV team will express their opinion on this matter sooner or later.

skvark avatar Apr 29 '21 20:04 skvark

Now is more understood. Maybe to call it for private use? Not sure how to approach it from legal view. If there is a lawyer in the crowd, maybe he can give advice.

talregev avatar Apr 29 '21 20:04 talregev

@skvark what do you think about openh264? https://www.openh264.org/faq.html Soon vcpkg will release ffmpeg with openh264. Will opencv will consider to distribute such a binary?

talregev avatar Apr 29 '21 21:04 talregev

Releasing build scripts != binaries distribution

alalek avatar Apr 29 '21 22:04 alalek

Can you elaborate?

talregev avatar Apr 29 '21 22:04 talregev