I have checked this question.
It is very similar:
I want to record a video with android camera.
After that with a library remove the background, which is with chroma key.
First I think I should use android NDK in order to escape from SDK memory limitation and use the whole memory.
The length of the video is short, a few seconds so maybe is able to handle it.
I would prefer to use an SDK implementation and set the android:largeHeap="true"
, because of mismatching the .so files architecture.
Any library suggestion for SDK or NDK please.
IMO you should prefer NDK based solution, since video processing is a CPU-consuming operation and java code won't give you a better performance. Moreover, the most popular and reliable media-processing libraries are often written in C or C++.
I'd recommend you to take a look at FFmpeg. It offers reach abilities to cope with multimedia. chromakey
filter may help you to remove green background (or whatever color you want). Then you can use another video as new background, if needed. See blend
filter docs.
Filters are a nice and powerful concept. They may be used both via ffmpeg
tool command line or via libavfilter
API. For the former case you should find ffmpeg
binary compiled for android and run it with traditional Runtime.exec()
. For the latter case - you need to write native code, that creates proper filter graph and performs processing. This code must be linked against FFmpeg libraries.
来源:https://stackoverflow.com/questions/40277272/android-video-remove-chroma-key-background