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

MacOS builds with FFMPEG shared libraries #49

Closed
techdragon opened this issue Oct 3, 2017 · 15 comments
Closed

MacOS builds with FFMPEG shared libraries #49

techdragon opened this issue Oct 3, 2017 · 15 comments

Comments

@techdragon
Copy link
Contributor

I've just taken my first attempt to get the homebrew formula for FFMPEG to support compiling an LGPL version -> Homebrew/homebrew-core#18909

If I've read your FAQ answer correctly... Assuming I can get those changes into HomeBrew, or I include an appropriately customised homebrew formula in this repo, it should be possible to build a version of FFMPEG suitable for use in a MacOS wheel. Is this correct?

@skvark
Copy link
Member

skvark commented Oct 3, 2017

Yes, that is correct as long as the FFmpeg version is LGPL and compiled with --enable-shared. I will not include any GPL'ed libraries to the wheels because then the whole package license would have to be GPL.

I have already experimented with FFmpeg LGPL builds on the Cent OS 5 containers and it seems that it should be possible to add FFmpeg support for Linux also.

Thanks for your work in advance :)

@techdragon
Copy link
Contributor Author

@skvark The default FFmpeg build on homebrew is built using --enabled-shared so the main issue is building without --enable-gpl which is/was part of the set options and not changeable with a build flag before my PR is merged. Speaking of the PR, it's now passing their CI checks so hopefully its merged soon.

I'm also glad to hear the Linux work appears possible since I was going to look at fixing that next. I'm fairly familiar with building things from source on linux but having not really used CentOS much I was concerned the build toolchain might be prohibitively difficult. Its one thing to compile some libraries from source code before compiling a program from sources, its another thing to need to build something like all of LLVM & clang using gcc because gcc is the only prebuilt compiler and the program won't compile with anything but clang.

@techdragon
Copy link
Contributor Author

@skvark I think I may have this working, but its a little hard to tell if it worked without the assets at the end and my travis-ci run didn't publish them anywhere useful. techdragon@b487193
https://travis-ci.org/techdragon/opencv-python/builds/286375673

@skvark do you want a PR regardless? or do you know a way I can get the wheel after travis is done in order to test these versions?

@skvark
Copy link
Member

skvark commented Oct 12, 2017

Sorry for the slow answer. As fas as I can see, the build does not have FFmpeg enabled:

--     FFMPEG:                      NO

--       avcodec:                   NO

--       avformat:                  NO

--       avutil:                    NO

--       swscale:                   NO

--       avresample:                NO

This is due to this error in brew recipe:

==> ./configure --prefix=/usr/local/Cellar/ffmpeg/3.3.4 --enable-shared --enable-pthreads --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-libmp3lame --enable-libx264 --enable-libxvid --enable-opencl --enable-videotoolbox --disable-lzma --enable-vda

Last 15 lines from /Users/travis/Library/Logs/Homebrew/ffmpeg/01.configure:

--enable-libmp3lame

--enable-libx264

--enable-libxvid

--enable-opencl

--enable-videotoolbox

--disable-lzma

--enable-vda



libx264 is gpl and --enable-gpl is not specified.



If you think configure made a mistake, make sure you are using the latest

version from Git.  If the latest version fails, report the problem to the

ffmpeg-user@ffmpeg.org mailing list or IRC #ffmpeg on irc.freenode.net.

Include the log file "config.log" produced by configure as this will help

solve the problem.

You have to remove --enable-libx264. It's a GPL plugin.

You can test if the video support is ok by enabling macOS test here: https://github.com/skvark/opencv-python/blob/master/tests/test.py

@techdragon
Copy link
Contributor Author

Thanks for dissecting the output there @skvark, due to some how homebrew flags work, it seems I did indeed misconfigure things. I'll dig back into this again and now I know I should see some useful information in the OpenCV log output hopefully I'll know if it worked this time. 😄

@techdragon
Copy link
Contributor Author

@skvark I've gotten this working in my fork, but the complete build time is too slow and causes Travis-CI to fail for all four of the Mac + OpenCV + OpenCV Contrib modules combinations. Are there any possible speedups in the MultiBuild repo you can think of?

@ofek
Copy link

ofek commented Oct 26, 2017

You could contact Travis and ask for an increased time limit.

@skvark
Copy link
Member

skvark commented Oct 26, 2017

Like @ofek said, I'll have contact Travis and ask if they can increase the time limit. There's no way to speed it up because brew builds FFmpeg from scratch.

Luckily this problem concerns only macOS since we can precompile FFmpeg on the Docker containers.

@techdragon
Copy link
Contributor Author

@skvark let me know once Travis-CI have raised the build timeout limit and I'll submit the PR.

@skvark
Copy link
Member

skvark commented Oct 31, 2017

I sent an email about build time limit increase to Travis. Waiting for an answer.

@skvark
Copy link
Member

skvark commented Nov 1, 2017

@techdragon Travis has now increased the build time limits. Feel free to create pull request.

@arthurbarros
Copy link

arthurbarros commented Nov 11, 2017

@techdragon any way I could help you on this PR? Let me know

@nicholasc
Copy link

@techdragon Same here. Anything I can do to help with for Mac OS or Linux builds with FFMPEG, let me know.

@techdragon
Copy link
Contributor Author

PR #56 opened. Hopefully the build doesn't time out.

@skvark
Copy link
Member

skvark commented Dec 7, 2017

Let's see, the build timeout limit should be at 90 minutes.

@skvark skvark closed this as completed Dec 19, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants