1

I have compiled FFmpeg for Android to suite my needs in terms of codecs, muxers etc. Now I have an executable that, from what I understand, should be placed in my project dir under <project-root>/external/<arbitrary-folder-name>/data/data/<my-app-package-name>/app_opt. What I have inside app_opt now is:

    .
├── bin
│   └── ffmpeg
├── include
│   ├── libavcodec
│   │   ├── avcodec.h
│   │   ├── avfft.h
│   │   ├── dxva2.h
│   │   ├── vaapi.h
│   │   ├── vda.h
│   │   ├── vdpau.h
│   │   ├── version.h
│   │   └── xvmc.h
│   ├── libavdevice
│   │   └── avdevice.h
│   ├── libavfilter
│   │   ├── asrc_abuffer.h
│   │   ├── avcodec.h
│   │   ├── avfiltergraph.h
│   │   ├── avfilter.h
│   │   ├── buffersink.h
│   │   ├── buffersrc.h
│   │   ├── version.h
│   │   └── vsrc_buffer.h
│   ├── libavformat
│   │   ├── avformat.h
│   │   ├── avio.h
│   │   └── version.h
│   ├── libavutil
│   │   ├── adler32.h
│   │   ├── aes.h
│   │   ├── attributes.h
│   │   ├── audioconvert.h
│   │   ├── audio_fifo.h
│   │   ├── avassert.h
│   │   ├── avconfig.h
│   │   ├── avstring.h
│   │   ├── avutil.h
│   │   ├── base64.h
│   │   ├── bprint.h
│   │   ├── bswap.h
│   │   ├── common.h
│   │   ├── cpu.h
│   │   ├── crc.h
│   │   ├── dict.h
│   │   ├── error.h
│   │   ├── eval.h
│   │   ├── fifo.h
│   │   ├── file.h
│   │   ├── imgutils.h
│   │   ├── intfloat.h
│   │   ├── intfloat_readwrite.h
│   │   ├── intreadwrite.h
│   │   ├── lfg.h
│   │   ├── log.h
│   │   ├── lzo.h
│   │   ├── mathematics.h
│   │   ├── md5.h
│   │   ├── mem.h
│   │   ├── opt.h
│   │   ├── parseutils.h
│   │   ├── pixdesc.h
│   │   ├── pixfmt.h
│   │   ├── random_seed.h
│   │   ├── rational.h
│   │   ├── samplefmt.h
│   │   ├── sha.h
│   │   ├── timecode.h
│   │   └── timestamp.h
│   ├── libpostproc
│   │   └── postprocess.h
│   ├── libswresample
│   │   └── swresample.h
│   └── libswscale
│       └── swscale.h
├── lib
│   ├── libavcodec.a
│   ├── libavdevice.a
│   ├── libavfilter.a
│   ├── libavformat.a
│   ├── libavutil.a
│   ├── libpostproc.a
│   ├── libswresample.a
│   ├── libswscale.a
│   └── pkgconfig
│       ├── libavcodec.pc
│       ├── libavdevice.pc
│       ├── libavfilter.pc
│       ├── libavformat.pc
│       ├── libavutil.pc
│       ├── libpostproc.pc
│       ├── libswresample.pc
│       └── libswscale.pc
└── share
    └── ffmpeg
        ├── examples
        │   ├── decoding_encoding.c
        │   ├── filtering_audio.c
        │   ├── filtering_video.c
        │   ├── Makefile
        │   ├── metadata.c
        │   └── muxing.c
        ├── ffprobe.xsd
        ├── libvpx-1080p50_60.ffpreset
        ├── libvpx-1080p.ffpreset
        ├── libvpx-360p.ffpreset
        ├── libvpx-720p50_60.ffpreset
        ├── libvpx-720p.ffpreset
        ├── libx264-ipod320.ffpreset
        └── libx264-ipod640.ffpreset

Do I need just the ffmpeg under bin to place in my project's <project-root>/res/raw dir?

And what is the easiest way to call ffmpeg and feed it with a command string?

I compiled FFmpeg with limited decoders and demuxers, because I need audio extraction only.

See: How can I get FFmpeg to locate installed libraries when --sysroot is pointing to another directory?

I would use it in background and notify the user in notification bar on completion.

I know that, here on SO, other similar questions are present, but they are a bit vague or confusing, at least for me. I understand at this point I lack of competences (actually my App is a jigsaw made of java-code-snippets from the Net that work together).

I'd appreciate some guidance. Thanks.

Community
  • 1
  • 1
dentex
  • 3,223
  • 4
  • 28
  • 47

2 Answers2

0

Although an executable 'ffmpeg' placed in a bin folder will run on a rooted phone, its actually not the best way to distribute ffmpeg in an app which will be suitable for general distribution.

The better interface is to use a standard JNI interface where android loads a shared lib permitting an invocation of ffmpeg and then calls the shell, android method serving as a wrapper for a CLI exec of ffmpeg.

For a great sample , see "android-ffmpeg-x264" project on github.

The android JNI interface is here

Robert Rowntree
  • 6,230
  • 2
  • 24
  • 43
  • Thanks for clarifying about the "root" way. I overlooked that. I'm going to look at the link provided. – dentex Feb 06 '13 at 18:18
  • HI, could you please provide me the so files ? I am under windows and I cannot compile ffmpeg using ndk :( – Paul Jul 14 '13 at 20:45
0

The project linked above is no longer supported. A newer alternative can be found at http://writingminds.github.io/ffmpeg-android-java/

GroovyDotCom
  • 1,304
  • 2
  • 15
  • 29