Closed mannol closed 7 years ago
Hi @mannol . Thanks you for taking a look such things. I'm not sure that i understand what's the problem, can you please change it and open PR
Before I do so, it's important to understand the limitations of using GPL in a project: "(TL;DR from wikipedia) ... if GPLed parts are used in a program (and the program is distributed), then all other source code of the program needs to be made available under the same license terms". Therefore, this module (react-native-video-processing) can only be used in opensource software, unless, the license exception is made by the original author of the software in question (this is the original project that is GPL'd: https://github.com/WritingMinds/ffmpeg-android-java).
In summary: either keep using ffmpeg-android-java and be opensource only module or switch back to mp4parser to support proprietary use.
I'll not switch back to mp4parser, since it don't have features which can give us ffmpeg.
So seems like we need change the licence, or i need to write my own ffmpeg-android 🤒 library from scratch with MIT licence. Thanks for letting me know about this issue.
I'll keep this thread open, and will close this when i'll decide what to do with this issue
Hey guys! @mannol @shahen94
Please clarify.
If we use ffmpeg
in react-native-video-processing
then Can we use react-native-video-processing
in commercial (not open sourced projects)?
Or the problem is not in the ffmpeg
? https://video.stackexchange.com/questions/14802/can-i-use-ffmpeg-in-a-commercial-product
Problem in ffmpeg-android-java
. Correct? https://github.com/WritingMinds/ffmpeg-android-java/blob/master/LICENSE.GPLv3
Problem is in ffmpeg-android-java
. We can use this library in private projects, as i understand.
How about Commercial and available to public (not open sourced)?
It should be fine, just this library(and forks) can't be developed in private repositories. But i'd like to see what will say @mannol
If I understand correctly.
1) If we use ffmpeg-android-java
-> then react-native-video-processing
must be re-licensed under GPLv3.
2) If we use react-native-video-processing
(which will be with GPLv3 license) -> then that Commercial project must be licensed under GPLv3 too.
Correct? @mannol @shahen94
If that is correct I'm going to write code that allow react-native-video-processing
to work without ffmpeg-android-java
...
@kesha-antonov how you're going to do that ?
I'm not sure now. But I think it's necessarily. I propose to join our forces and make it
It's just a binary ffmpeg
that needs to be executed. Seems like not so difficult task
I'll try to do some dummy implementation. And then we all will do something better
Now I'm trying to build ffmpeg with https://github.com/cisco/openh264 instead of x264. It's free. For x264 we have to pay for license. 🤕
I'll return once I'll make progress with this. Maybe in an other issue/PR
I see that we need:
Anything else? For now it solvable 👍 Just will take a few days
@kesha-antonov yes, you are correct: ffmpeg-android-java
is the problematic code. If you remove that, you can use ffmpeg in your code as long as you comply with the ffmpeg's guide for using ffmpeg in commercial applications. AFAIK ffmpeg-android-java
is convenience wrapper over ffmpeg which simplifies instalation of ffmpeg for android applications. Creating something like it should be relatively trivial.
Alright.
Then we have no choice. We have to do those 2 tasks I mentioned above:
react-native-video-processing
and do dummy implementation of calling ffmpeg.2. Use dynamic linking (on windows, this means linking to dlls) for linking with FFmpeg libraries.
What this means to us? https://www.ffmpeg.org/legal.html
13. Remove any prohibition of reverse engineering from your EULA.
Is it OK for us?
Every solid EULA I know is against this. But FFmpeg wants us to remove that prohibition...
Hi, since GPUImage is used on the iOS Side, could the following be a viable substitute for ffmpeg alltogether? https://github.com/CyberAgent/android-gpuimage
Just wanted to throw the idea out there.
@CaptAhak AFAIK GPUImage is not used on iOS side for crop, trim, compress video. It's just stubbed there for future work. (or maybe for filters?). I'm using only API.
Correct? @shahen94
@kesha-antonov that's correct, GPUImage is still not used on iOS side for crop, we'll use it for filters
@CaptAhak i'm not sure that GPUImage have the same features which have ffmpeg
The question is - What to use in android.
I was able to build ffmpeg with openh264. I will try to link it and use without ffmpeg-android-java
If there any other solution for android with Trim/Crop/Compress with Permissive License I will help to integrate it here.
@kesha-antonov I think ffmpeg is your best bet. About the questions you asked:
Use dynamic linking (on windows, this means linking to dlls) for linking with FFmpeg libraries
That means that you are forced to link dynamically if you were to link with FFmpeg in your binary. Considering that you will not link FFmpeg in your binary (or any binary using react-native-video-processing) in any way but, rather, use the FFmpeg stand-alone binary, you are covered concerning that rule.
Remove any prohibition of reverse engineering from your EULA
Same as above. You are not linking with FFmpeg henceforth, different rules apply. See this answer for more detailed info. Specifically these lines:
If the program uses fork and exec to invoke plug-ins, then the plug-ins are separate programs, so the license for the main program makes no requirements for them
non-GPL application calls a GPL application at the command line -> definitely legal
Hope these answers help.
@mannol Nice. I think it's good for us.
You meant LGPL
application, right? Not GPL
?
Now about binaries.
Correct me if I'm wrong:
we must have 2 binaries separately
1) App with react-native-video-processing
2) ffmpeg binaries
We put ffmpeg binaries in react-native-video-processing
in the assets
directory.
And then call them from App with loadFfmpeg
Where loadFfmpeg
is our new dummy method to load ffmpeg binaries (copy/execute...?)
Or what is the correct way to separate binaries to run ffmpeg correctly (with dynamic linking)?
I'm pretty new to android dev. I appreciate any help/suggestions
We can put binaries in libraries/ffmpeg
director - Then we should call loadFFMPEG
in RNVideoProcessingPackage.java
file
LGPL is more permissive than GPL. Regardless, same rules apply. About the implementation: you will, most likely, have to use Runtime.exec() function from java standard library to execute FFmpeg process.
Note about linking: linking several libraries in a single entity creates a single program. Since you will be using FFmpeg as a program, there is no linking of FFmpeg with react-native-video-processing. Therefore, as long as you use it like that (calling Runtime.exec() on FFmpeg binary), you are set.
EDIT: you must not load ffmpeg.so directly using System.load(). That way different rules apply.
OK! Thanks guys ! 👍 I'll try do it and will get back with questions
@kesha-antonov check the edit
Thanks! @mannol
Hey guys.
I've built ffmpeg with openh264.
When I try to compress video with libopenh264 it gives me error: CANNOT LINK EXECUTABLE. library "libopenh264.so" not found page record for 0x..... was not found (block_size=16)
Does this mean that i should put libopenh264.so
in the same directory with ffmpeg
?
I did not found options to disable shared libs.
https://github.com/cisco/openh264 https://github.com/cisco/openh264/issues/1529
I saw that libx264 was compiled with these options and worked without errors.
--enable-static \
--disable-shared \
But I don't see these options for building openh264
Maybe I should put some other flags?
Seems like you should put libopenh264
in the project.
https://trac.pjsip.org/repos/ticket/1758
Shared libraries should go in libs/
directory (probably android/app/src/libs/armeabi-v7a/
for react native). I think it should work even if you place it in the same directory as your binary.
Alright! I'll try both
Same error.
https://github.com/kesha-antonov/ffmpeg-android-java/commit/de38625d61804bb23e252636cbaa4e86b8267f9e
Any thoughts?
Tried to put in node_modules/react-native-video-processing/android/src/main/jniLibs/
.
Same error
Try to place them in modules/react-native-video-processing/android/src/main/jniLibs/armeabi-v7a/
Already. That did not help (same error)
ls node_modules/react-native-video-processing/android/src/main/jniLibs
armeabi-v7a/ x86/
Can you help me to integrate it into RN-video-processing
?
I have ffmpeg with openh264 + libopenh264.so
It's time for task №2 - somehow integrate it here without ffmpeg-android-java
Maybe it copies ffmpeg to some other directory where ffmpeg can't see *.so
?
https://github.com/kesha-antonov/ffmpeg-android-java/blob/master/FFmpegAndroid/src/main/java/com/github/hiteshsondhi88/libffmpeg/FFmpegLoadLibraryAsyncTask.java#L27
Guys. Really need your help Working on this > 24 hours already
Here's results: 1) Scripts to build ffmpeg with openh264: https://github.com/kesha-antonov/ffmpeg-android/commits/release/v0.4 2) Builds: https://github.com/kesha-antonov/ffmpeg-android-java/commits/master (ffmpeg with openh264 + .so files) 3) RN-video-processing with openh264: https://github.com/kesha-antonov/react-native-video-processing/commits/get_rid_of_ffmpeg_android_java
I don't have time anymore for now Let's continue and finish it. We all need this ASAP
Here's what ffmpeg gives about license:
Crop and Trim are working. Compress (which requires openh264) does not.
So maybe better to do integration of ffmpeg and then fix that error with shared lib.
One more thing.
RN-video-processing
uses https://github.com/wseemann/FFmpegMediaMetadataRetriever which uses ffmpeg
https://github.com/wseemann/FFmpegMediaMetadataRetriever/tree/master/gradle/fmmr-library/library/src/main/ffmpeg
Right? Should we do some about it too?
I'm not sure, maybe @mannol can help you with that question.
@kesha-antonov i'm in vacation in these days, i'll try to help when i'll get to my computer
Looks like FFmpegMediaMetadataRetriever
uses FFmpeg directly (links with FFmpeg), and I've checked their FFmpeg build flags which seem to comply with guidelines provided by FFmpeg project. It's ok to use it for this project.
Ok guys! Thanks!
Hello @shahen94 Have you had time to try to link ffmpeg and "libopenh264.so" shared lib?
Hi @kesha-antonov , sorry for slow reply. I'm in vacation and will get back in the end of August. I'll work on this right away when i'll back to home
@shahen94 Ok!
I think we need to add warning in the README. To people know about problem with licensing
I'll try to find time to solve this and make build
AFAIK this library is using: https://github.com/kesha-antonov/ffmpeg-android-java which is licensed under GPLv3. There should be a notice in the README about the limitations of using this library.