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

Build ffmpeg for android with mediacodec support #589

Merged
merged 2 commits into from
Jul 14, 2018

Conversation

tmm1
Copy link
Contributor

@tmm1 tmm1 commented Jul 12, 2018

cc #587

@tmm1
Copy link
Contributor Author

tmm1 commented Jul 12, 2018

I tested this locally for android-arm and the resulting libavcodec.so was built with mediacodec enabled.

@saudet
Copy link
Member

saudet commented Jul 13, 2018

I'm getting an ERROR: jni not found message from FFmpeg's configure script with that, at least for android-arm64, with thess details in the config.log:

/home/saudet/Android/android-ndk//toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64/bin/aarch64-linux-android-gcc -Wl,--no-undefined -z text -L../lib/ -L/home/saudet/Android/android-ndk//sources/cxx-stl/gnu-libstdc++/4.9//libs/arm64-v8a/ -Wl,--no-undefined -z text --sysroot=/home/saudet/Android/android-ndk//platforms/android-21/arch-arm64/ -Wl,--as-needed -Wl,-z,noexecstack -o /tmp/ffconf.tD50XJ6R/test /tmp/ffconf.tD50XJ6R/test.o -lgnustl_static -lgcc -ldl -lz -lm -lc
/tmp/ffconf.tD50XJ6R/test.o: In function `foo':
test.c:(.text.foo+0x7c): undefined reference to `cexp'
collect2: error: ld returned 1 exit status
ERROR: jni not found

You're not getting this?

@tmm1
Copy link
Contributor Author

tmm1 commented Jul 13, 2018

I was seeing that with an earlier commit before I changed target-os to android.

Let me try with android-arm64 here..

@tmm1
Copy link
Contributor Author

tmm1 commented Jul 13, 2018

The requirements on the ffmpeg side are pretty simple: https://github.com/FFmpeg/FFmpeg/blob/master/configure#L5995

The build works on my Mac:

External libraries:
jni                                libvo_amrwbenc

Maybe I'm not running it right?

ANDROID_NDK=$HOME/Downloads/android-ndk-r15c
mvn install --projects .,ffmpeg -Djavacpp.platform=android-arm64 -Djavacpp.platform.compiler=$HOME/Downloads/android-ndk-r15c/toolchains/aarch64-linux-android-4.9/prebuilt/darwin-x86_64/bin/aarch64-linux-android-g++ -Djavacpp.platform.root=$HOME/Downloads/android-ndk-r15c/

Or maybe I have jni.h in my environment? It exists in the NDK sysroot too so it seems like it would still work.

@tmm1
Copy link
Contributor Author

tmm1 commented Jul 13, 2018

cppbuild.sh directly works too:

ANDROID_NDK=~/Downloads/android-ndk-r15c bash cppbuild.sh -platform android-arm64 install ffmpeg

Should I try on Linux?

@saudet
Copy link
Member

saudet commented Jul 13, 2018

Yeah, seems something specific to Linux for some reason.

@saudet
Copy link
Member

saudet commented Jul 13, 2018

But it looks like it works on Travis CI, strange...

@saudet
Copy link
Member

saudet commented Jul 14, 2018

Ah, it looks like I was missing --target-os=android. With that, it seems to build fine for me locally on Linux as well, thanks!

@tmm1
Copy link
Contributor Author

tmm1 commented Jul 14, 2018

Great! So this should be good to go.

@saudet saudet merged commit 075c29e into bytedeco:master Jul 14, 2018
@tmm1 tmm1 deleted the ffmpeg-mediacodec branch July 15, 2018 02:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants