How to install ffmpeg and an app together on a Mac? - xcode

I have an electron app built and packaged for macOS in a .app file. The app requires ffmpeg to be installed on the end-user's computer to be used.
Currently, I've had to manually install ffmpeg on each end-user's computer to run the app.
I want to distribute the app online with an easy installer for both ffmpeg and the app. I've seen .dmg files which allows you to drag the .app into the applications folder easily, but the ffmpeg dependency is still absent in the installation process.
How can I install ffmpeg and the app together on a mac?
Perhaps including the ffmpeg build in the .app content is a solution as well.
This may not be possible though because a relevant question mentions there are only abstractions of the ffmpeg CLI instead of something that can directly use ffmpeg.

You should include ffmpeg in the .app. That way you…
Don't need admin privileges to install or update your app.
Don't risk conflicting with a different copy of ffmpeg on the user's computer.
See this answer for Electron-specific instructions: How can I bundle a precompiled binary with electron.

sorry for late response but in case it's still relevant to someone: I created ffbinaries module exactly for this purpose.
You can download binaries for user's platform either during app boot or in CI/prepackaged scenario (platform will be automatically detected if you don't specify it yourself).

you can create a PKG file in mac which can install your app along with any other third party apps.You can try Seema's answer from here

You can try this one to install ffmpeg on mac, it worked for me:
brew install --build-from-source ffmpeg

This question also requires an understanding of the ffmpeg license. In summary, due to licensing issue, do not bundle ffmpeg with your app but allow the user to download and install ffmpeg on her own.
Are you distributing your app as
a. GPL - open source with all source code publicly available
b. non-commercial closed source app
c. commercial app
See the ffmpeg licensing here - https://www.ffmpeg.org/legal.html
FFmpeg is licensed under the GNU Lesser General Public License (LGPL) version 2.1 or later. However, FFmpeg incorporates several optional parts and optimizations that are covered by the GNU General Public License (GPL) version 2 or later. If those parts get used the GPL applies to all of FFmpeg.
Read the license texts to learn how this affects programs built on top of FFmpeg or reusing FFmpeg. You may also wish to have a look at the GPL FAQ.
Note that FFmpeg is not available under any other licensing terms, especially not proprietary/commercial ones, not even in exchange for payment.
Even with an open source app - discretion is advised. For example, Audacity is a popular open source app that uses ffmpeg. See here - https://manual.audacityteam.org/man/installing_ffmpeg_for_windows.html
Because of software patents, Audacity cannot include the FFmpeg software or distribute it from its own websites. Instead, use the following instructions to download and install the free and recommended FFmpeg third-party library.

Related

How can I download the libsvt_hevc library on ffmpeg on a Mac?

I need to perform Scalable Video Encoding on a video using ffmpeg. In order to do so, I need to have the libsvt_hevc library. So any idea how add this library to Ffmpeg on a Mac?
I tried downloading the library but none of the links available online are suitable for Mac.

Legal issues in shipping apps based on Electron framework (libffmpeg)

We're in the process of building and deploying a desktop based app on electron v 12.0.7. It'll be a (free) commercial software deployed to ~2-3M users worldwide.
Recently our legal team enquired about the proprietary codecs bundled with chromium and I thought the best way to confirm this would be to reach out here.
So, here're specific things that I need help with:
Are we shipping chromium with proprietary codecs? If yes, what are potentially contentious codecs that come by default in chromium bundled with electron v 12.0.7?
Is there any documentation around how the electron team builds chromium (with what flags)?
Is the default libffmpeg.dylib/dll bundled with electron building ffmpeg with support for things like H.264 and MP3 codecs?
I noticed there are libffmpeg binaries available with each electron build, e.g. https://github.com/electron/electron/releases/download/v12.0.7/ffmpeg-v12.0.7-darwin-arm64.zip . What's the purpose of this binary?
Any help would be appreciated.
Ok, it took a while to plummet through all the information out there.
I started wth https://github.com/electron/libchromiumcontent/issues/174#issuecomment-184187254 and ended up on electron's discord server talking with multiple folks from electron team. I'm collating my findings here so that it may save some time for someone.
Here're what I found out. Any corrections/edits are more than welcome so that the information presented here is correct.
Are we shipping chromium with proprietary codecs?
If yes, what are potentially contentious codecs that come by default in chromium bundled with electron v 12.0.7?
YES. At least on OSX, the libffmpeg.dylib that comes by default with electron contains exported symbols (for proprietary decoders) for AAC and H264. So, they remain in the realm of non-royalty-free software. I think legal advice is required here if you're planning to ship your application commercially(using default electron + libffmpeg.dylib)
e.g. List of exported decoders from the dylib can be viewed using the following command:
nm -gU /Applications/{your-app-name}.app/Contents/Frameworks/Electron\ Framework.framework/Versions/A/Libraries/libffmpeg.dylib | grep 'decoder'
I wrote a simple python script to look at any electron-based app, and print list of decoders available inside libffmpeg (bundled inside an electron based app).
Sample output from my script: (My app is built with electron v 12.0.7)
Decoders available/exported from libffmpeg.dylib: ['aac', 'aac-latm',
'flac', 'h264', 'libopus', 'mp3', 'pcm-alaw', 'pcm-f32le',
'pcm-mulaw', 'pcm-s16be', 'pcm-s16le', 'pcm-s24be', 'pcm-s24le',
'pcm-s32le', 'pcm-u8', 'theora', 'vorbis', 'vp3', 'vp8']
So defintely we have aac and h264 decoders (non-royalty-free-software) going out by default with our electron-based application. To the best I know, these could lead to possible patent-infringement issues.
2. Is there any documentation around how the electron team builds chromium (with what flags)?
I couldn't find any conclusive documents but https://github.com/electron/electron/blob/58c58c46c4e03c996983a0c71163e1a5efed12fa/build/args/all.gn hints that by default proprietary_codecs is set to true in electron's build
3. Is the default libffmpeg.dylib/dll bundled with electron building ffmpeg with support for things like H.264 and MP3 codecs?
It certainly looks to be the case (based on above)
4. I noticed there are libffmpeg binaries available with each electron build, e.g. https://github.com/electron/electron/releases/download/v12.0.7/ffmpeg-v12.0.7-darwin-arm64.zip . What's the purpose of this binary?
If you care about shipping royalty free binaries and not deal with patent issues, this is what probably you should use (unless you chose to build whole electron by yourself tweaking gn args).
A quick check of these ffmpeg.dylib reveal that AAC and H264 decoders are not present(or atleast it doesn't have exported symbols for them). So it leads me to believe that these custom versions of dylib are built by electron team keeping this in mind. Using same script this is the output for list of decoders available in custom version of libffmpeg
Decoders available/exported from libffmpeg.dylib: ['flac', 'libopus',
'mp3', 'pcm-alaw', 'pcm-f32le', 'pcm-mulaw', 'pcm-s16be', 'pcm-s16le',
'pcm-s24be', 'pcm-s24le', 'pcm-s32le', 'pcm-u8', 'theora', 'vorbis',
'vp3', 'vp8']
So this is the difference between two versions of dylib (left one is downloaded from electron site, right one is what comes by default with electron)
It also appears that this problem was already identified and we have a plugin for electron-packager that does all the heavy-lifting for you: https://github.com/MarshallOfSound/electron-packager-plugin-non-proprietary-codecs-ffmpeg
Since we din't use electron-packager (but electron-builder), i had to resort to put this logic of replacing libffmpeg in afterPackHook
: https://www.electron.build/configuration/configuration#afterpack
Important step to remember is that: this replacement needs to be done before we code-sign the whole app (or it breaks the code-sign integrity).
Hope it helps someone else going through the same problem.
Cheers!

How to write into a MP4 container with Cocoa?

I need to export an MP4 file containing several streams of audio. There is no video at all at this point in time, though this might be requested sometimes in the future.
All this is on the Mac running a decently recent version of Mac OS X. QT Kit is not an option. Portability to iOS would be a bonus.
Where should I look? A very casual look at AV Foundation suggests this might be a way, but doesn't look simple at all.
Or should I rather look for a third party library? ffmpeg? mp4v2?
Thanks for any suggestion.

Building Libraries on Windows

Hobbyist and newbie, so no laughing ;)
I have been developing some toy programs on my Mac for a long time and everything is nice and straightforward.
I was trying to port one of my existing projects to Windows (as a way to get started in developing for Windows) but am stuck trying to build the libraries I have come to love in a Unix environment under Windows (and MinGW).
At the risk of revealing my naïvety, could someone just run through how to build and install a library on Windows (including any special software required)?
For example, an install readme might look like this:
Do this to install:
./configure
make
make install
Obviously on Windows that pukes...so what are the analogous steps on Windows?
You have a couple of options wrt building unix style libraries on windows:
Google for a pre-built binary distribution made for windows of the library in question.
If the libraries authors have bothered to support it, you can try installing Cygwin to get a posix like build environment on windows
Some libraries - like OpenSSL - have a set of build instructions for windows that include installing ActiveState Perl, and then running the appropriate configure script manually.
Where the authors of the library have made no special effort, you are pretty stuck: Create a static library project in the dev environment, add the libraries files to it, create (or move) the headers that the ./configure step usually creates or moves and build it yourself.
It is a tragic state of affairs that doing this "simple" task is so hard. Developers seem to take one of two lessons away from this:
Microsoft is the devil. Microsoft hates developers. Hates open source software. And is ###$. Compiling libraries and software from source via a standardized ./configure & make install process is the one true way.
Microsoft is the one true way. The microsoft eco system of pre-built .lib files and headers is perfection and people who build everything from source using arcane perl scripts and install into a standardized filesystem are mentally defective.
Your pick :P

Installing just Quicktime libraries on Windows

There's Quicktime SDK for Windows, but any application that uses it needs quicktime runtime libraries to be installed on the system (SDK itself just has headers and library stubs, and not the actual DLLs).
If my application uses Quicktime, I'd like to install the necessary libraries with it's installer, thus not requiring user to install Quicktime separately. What I'm looking for is some sort of "quicktime redistributable".
As of now (quicktime 7.x), I can't find a way to do that. I could bundle whole quicktime installer (about 20 MiB), and launch it with MSI's silent/unattended flag. However, that way it has several side effects:
creates Quicktime player shortcut on desktop and in quick launch bar
hijacks file associations, (e.g. .mov becomes associated with Quicktime Player, even if it was associated with something else before)
installs some service/process (qttask) that presumably watches for Quicktime associations, or handles auto-updates.
installs Quicktime Player, which I don't need in fact.
Of the above, first three are quite bad.
Is there a way to "just install the libraries" for Quicktime?
In my application, I'd use Quicktime to import images, movies and audio files in various formats. If there is no sane way to install Quicktime runtime without side effects (changed file associations, extra icons, ...), then I should be seriously looking at alternative solutions (e.g. FreeImage to load images, perhaps DirectShow for video/audio).
If you need to redistribute QuickTime, see QuickTime Licensing for details. You're not allowed to redistribute any of the QuickTime libraries without a written agreement with Apple. Many CD-replication companies will actually request proof of this agreement before printing large numbers of CDs.
I would definitely not distribute "QuickTime Lite" without consulting with either a lawyer or your Apple licensing representative.
Your best bet, AFAIK, is to use the full QuickTime installer (all 20MB of it), and have your main installer run it with a "silent" flag. That, at least, will allow your users to install QuickTime without a half-dozen dialogs (and without those annoying pictures of surfers in bikinis). The people at Apple's licensing division seemed to think that using the "silent" flag was acceptable, at least when we consulted them.
One warning: If the user already has an older version of QuickTime 6 Pro (or earlier) installed, then installing QuickTime 7 silently will nuke their QuickTime Pro registration and they'll have to repurchase it. We actually detect this situation in our installer and display a warning during the installation process, much like Apple does.
Yes, this is a pain. After 6+ years of working with QuickTime, I'd honestly recommend looking at other video frameworks. We're currently evaluating Ogg Theora.
You could include, with your setup package, a program called Quicktime Lite. It comes with the same libraries as Quicktime uses, but is much, much smaller.
Here"s the link:
Download Quicktime Lite
Quicktime Alternative does what you want, but for the reasons others have stated here, its illegal. Apple probably is not going to let you do what you want.

Resources