How to build and use ffmpeg within android

2019-04-24 09:45发布

I am prototyping a fairly simple camera app to test out using MediaRecorder to create a custom camera activity with one snag, I want to set the aspect ratio of recorded videos to a 1x1. Through much research I have found that this is only possible by using a library like FFMPEG to crop each frame of the video to the size I desire.

I have read many tutorials and articles on different ways to build FFMPEG into Android, but most of them are either outdated and use older versions of both the Android NDK and FFMPEG, or more recent ones just do not work when followed. I tried following the popular http://www.roman10.net/how-to-build-ffmpeg-for-android/‎ and a few other similar ones that all lead to an error about a missing pkg-config file because FFMPEG is generally meant to be installed on linux or another OS apparently. I found some information about building FFMPEG in android by using a make-standalone-toolchain.sh file here http://software.intel.com/en-us/android/blogs/2013/12/06/building-ffmpeg-for-android-on-x86 and can't make heads or tails as to how to go about using this method.

This now leads into my question: What is the best/proven way currently to build and use FFMPEG within android applications? If the standalone toolchain method is the way to go, is there any material better than the one listed that is easier to follow? I would even be open to a reliable template application with the FFMPEG Libraries ready to go (if this is possible); although, I would much rather know how to build this into android for future use.

Thank you in advance for any advice or suggestions on this issue.

2条回答
smile是对你的礼貌
2楼-- · 2019-04-24 10:21

This is the guide I liked the most: http://www.roman10.net/how-to-build-ffmpeg-with-ndk-r9/

If you need more options, you can take a look at these, which are equally good:

EDIT: I updated the first link with a more recent article (it uses NDK r9).

查看更多
劫难
3楼-- · 2019-04-24 10:24

I have successfully build ffmpeg libraries using

https://code.google.com/p/dolphin-player/

You have to be on Ubuntu to build that.

查看更多
登录 后发表回答