androidffmpegandroid-ffmpeglamemobile-ffmpeg

Ffmpeg Android - Minimum binary size to convert WAV to MP3


The only thing I want to do is convert wav files to mp3 inside my Android application.

I am currently using https://github.com/tanersener/mobile-ffmpeg and with audio-release everything is working fine. As the lib size is about 40 MB and I only need a single command, I'd like to build my own .aar file as described in the Wiki to reduce the application size.

I edited the android-ffmpeh.sh ./configure:

--disable-everything \    
--enable-pthreads \
--enable-avcodec \
--enable-avformat \
--enable-swresample \
--enable-avfilter \
--enable-libmp3lame \
--enable-parser=mpegaudio \
--enable-demuxer=mp3,wav,pcm_s16le \
--enable-muxer=mp3,wav,pcm_s16le \
--enable-decoder=pcm*,mp3*,wav,pcm_s16le \
--enable-encoder=pcm*,pcm_s16le,wav,mp3,libmp3lame \
--enable-filter=aresample \
--enable-protocol=file \

and then ran ./android.sh -l --enable-lame --enable-libiconv

In my Android app FFmpeg loads but the conversion doesn't succed with following error:

E/mobile-ffmpeg: [AVFilterGraph @ 0x7209dfec40] No such filter: 'anull'
E/mobile-ffmpeg: Error reinitializing filters!
E/mobile-ffmpeg: Failed to inject frame into filter network: Invalid argument
E/mobile-ffmpeg: Error while processing the decoded data for stream #0:0
I/mobile-ffmpeg: Conversion failed!

Does anyone know what I'm missing or another config to build a minimal size binary for this. Any help is highly appreciated!


Solution

  • The ffmpeg tools can call upon the following filters automatically: aformat anull atrim format hflip null transpose trim vflip. configure is set to select them automatically unless overridden, which you have by declaring --disable-everything. So, these filters need to be manually enabled.