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

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!

Related

Xamarin.Forms video streaming library that supports RTSP video feeds

I am using Plugin.MediaManager NuGet package to provide cross-platform video player for my app. However, it does not support playing RTSP video streams. Is there any other library that supports this?
I have looked around and the most common ones are platform-specific libraries such as KXmovie and Managed Media Aggregation but I am a little intimidated by the thought of having to port and/or recompile them.
The best case is if there is a Xamarin.Forms compatible NuGet package available. Failing that, an iOS library that requires binding, but not recompiling. As a last resort, something that needs to be compiled and linking manually, but works out of the box.
OK so the resounding conclusion is that one does not exist with Xamarin bindings. I will start with this project on GitHub and see if I can compile and generate the bindings myself.
A bit late, but there is now. LibVLCSharp supports RTSP (and many other stuff).

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

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.

MP4 codec support in Chromium

We have integrated Chromium Embedded Framework into our Windows game to allow us to render web pages from within our application, and everything works fine, except MP4 videos.
I understand Chromium does not include this codec due to licensing issues, but can anyone provide details on how we can add support, even if we have to license a codec for it.
All the information we can find seems to be old, and the functions referred to appear to be deprecated... so we are at a bit of a loss.
All the video serving networks we have spoken to appear to serve MP4s.. so changing encoding does not seem to be an option.
Any advice would be greatly appreciated.
Thanks
Check this url
Go to menu option Features --> Html5 Audio/Video section. It mentions that Nik's build (66.0.3359.181) has supported Mp4 (and other codecs).
If there is any licensing issues with using H.264/MP4, I am not aware about it, so please check for it before using.
Keep in mind that MP4 is not a codec it's a container format. You need to support all codecs that might be contained in a MP4 file.
In a recent post on a CEF forum someone managed to do it by setting the environmental variable:
GYP_DEFINES="proprietary_codecs=1 ffmpeg_branding=Chrome"
before running the automate-git.py script.
Source: Build CEF with proprietary codecs support

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.

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