3

I am trying to use FFMPEG library for Video compression on Android.

I've compiled the library using : http://bambuser.com/opensource and https://www.quora.com/What-are-the-steps-for-integrating-FFMPEG-on-Android

Now next step is NDK build of this. But I am not sure what all will go as LOCAL_SRC_FILES, LOCAL_LDLIBS and LOCAL_C_INCLUDES.

Apart from that what function should be called for compression in this library.

Please suggest.

1 Answer 1

5

For ffmpeg use on Android (or other platforms) there are a number of common approachs you can take:

  • invoke the command line from your program via EXEC command (has some limitations and drawbacks)
  • use a wrapper around the ffmpeg command line C program
  • Directly use the ffmpeg libraries, or more accurately the libraries that ffmpeg uses

The wrapper approach may be the easiest is you simply want to get the functionality working quickly.

There are several fairly well used wrappers available on GitHub - the ones below are particularly well featured and documented (note, I have not used these as they were not so mature when I was looking at this previously, but if I was doing something like this again now I would definitely build on one of these):

Using one of the well supported and used libraries will take care of some common issues that you might otherwise encounter - having to load different binaries for different processor types, and some tricky issues with native library reloading to avoid crashes on subsequent invocations of the wrapper.

Because this approach uses the standard ffmpeg cmd line syntax for commands it also means you should be able to search and find help easily on multiple different operations (as anyone using ffmpeg in 'normal' model will use the same syntax for the ffmpeg command itself).

3
  • Thanks Mick. It worked like charm. :) I've one more issue with size of APK after including this. It increased by 26 MB. I tried using separate APK for separate CPU Arch. But is there any other way I can reduce it?
    – Rahul
    Mar 1, 2016 at 10:05
  • Sorry missed the comment somehow - somewhere between 15-23M is about what I have seen also, depending on whether you include the binaries for each arch. I think if you wanted to get it much better you would have to start getting much more into the detail of ffmpeg and it might not make as much sense to use the wrapper approach at that stage.
    – Mick
    Jul 16, 2016 at 22:39
  • Hi Rahul, can you help me with the same issue by providing the working video compression java code/library with minimum size? Thanks Jan 9, 2019 at 9:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.