[FFmpeg-devel] [PATCH] add support to Android ndk MediaCodec for encoding/decoding

Olivier Ayache olivier.ayache at gmail.com
Sun Jun 28 15:48:29 EEST 2020


Thank for your replies I choose the NDK approach in order to  be able to be
independant from the JVM, to maximize performance and to be sure to detect
compatibility issues (using JNI approach can compile and crash at runtime).
Concerning the version of Android it is compatible from API 21 (94% of
devices)
I agree that JNI overhead is not big but in combinaison with Xuggler it
seems to me a little weird because Xuggler (Java part) already use JNI to
interact with Xuggler (C++) and FFmpeg. If FFmpeg uses JNI in the other way
(from c to Java) it seems to me an anti pattern.

If you think it is better to begin to use JNI I could transform my encoder
and we could discuss about NDK after

Olivier



Le sam. 27 juin 2020 à 20:55, Martin Storsjö <martin at martin.st> a écrit :

> On Sat, 27 Jun 2020, Olivier Ayache wrote:
>
> > Hi everyone this is the first time I post on this mailing list. I am
> > working since several years on a fork of Xuggler for manipulating ffmpeg
> > API with Java/Kotlin.
> > This work leads me to develop encoder and decoder based on Android NDK
> > MediaCodec.
> >
> > This work can be found on my Github repository
> >
> > https://github.com/olivierayache/xuggle-xuggler
> >
> >
> > I know that FFmpeg already integrate MediaCodec for decoding via Jni
> > wrappers since version 3.1. I began this work on FFmpeg 2.8.x and I
> choose
> > the NDK in order to achieve optimum performance.
>
> If you mean you used the NDK MediaCodec API, I'd suggest you use the same
> JNI wrappers as ffmpeg has already, for consistency. The overhead of a few
> JNI calls per encoded frame is generally negligible. If it, at a later
> time, is decided to drop support for older versions at some point, it
> should be straightforward to convert it to use the NDK MediaCodec API
> instead.
>
> // Martin
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request at ffmpeg.org with subject "unsubscribe".


More information about the ffmpeg-devel mailing list