我已经尝试过以下链接,但没有成功使用最新版本。
http://writingminds.github.io/ffmpeg-android-java
https://github.com/WritingMinds/ffmpeg-android-java
https://github.com/havlenapetr/FFMpeg
http://writingminds.github.io/ffmpeg-android-java
https://github.com/WritingMinds/ffmpeg-android-java
https://github.com/havlenapetr/FFMpeg
FFMPEG
的最新版本是3.1.1,仅在12天前发布。因此我认为没有像这个旧版本那样随时可用的演示。
我们需要自己构建FFMPEG
库。我在这里贴出一些问题,可能会对你有所帮助。(未经测试)
如何为Android构建FFmpeg
FFMPEG
。 还有一篇教程:如何为Android构建FFmpeg。这篇教程比较老,所以您只需要更改这里提到的版本。对于FFMPEG
,它将是3.1.1
,对于NDK,它将是r12b
。
使用 NDK r12b 构建 FFMPEG
:
Download Android NDK : The latest version of Android NDK can be downloaded at Android NDK website. At the time of writing this answer, the newest version is NDK r12. simply decompress the archive
Download ffmpeg source code : FFMPEG source code can be downloaded from the ffmpeg website. The latest stable release is 3.1.1 (at the time of writing). Download the source code and decompress it to $NDK/sources folder.
Update configure file : Open ffmpeg-3.1.1/configure file with a text editor, and locate the following lines.
SLIBNAME_WITH_MAJOR='$(SLIBNAME).$(LIBMAJOR)'
LIB_INSTALL_EXTRA_CMD='$$(RANLIB) "$(LIBDIR)/$(LIBNAME)"'
SLIB_INSTALL_NAME='$(SLIBNAME_WITH_VERSION)'
SLIB_INSTALL_LINKS='$(SLIBNAME_WITH_MAJOR) $(SLIBNAME)'
This cause ffmpeg shared libraries to be compiled to libavcodec.so. (e.g. libavcodec.so.55), which is not compatible with Android build system. Therefore we’ll need to replace the above lines with the following lines.
SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
LIB_INSTALL_EXTRA_CMD='$$(RANLIB) "$(LIBDIR)/$(LIBNAME)"'
SLIB_INSTALL_NAME='$(SLIBNAME_WITH_MAJOR)'
SLIB_INSTALL_LINKS='$(SLIBNAME)
Build ffmpeg : Copy the following text to a text editor and save it as build_android.sh in ffmpeg_3.1.1 folder.
#!/bin/bash
NDK=$HOME/Desktop/adt/android-ndk-r9
SYSROOT=$NDK/platforms/android-9/arch-arm/
TOOLCHAIN=$NDK/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64
function build_one
{
./configure
--prefix=$PREFIX
--enable-shared
--disable-static
--disable-doc
--disable-ffmpeg
--disable-ffplay
--disable-ffprobe
--disable-ffserver
--disable-avdevice
--disable-doc
--disable-symver
--cross-prefix=$TOOLCHAIN/bin/arm-linux-androideabi-
--target-os=linux
--arch=arm
--enable-cross-compile
--sysroot=$SYSROOT
--extra-cflags="-Os -fpic $ADDI_CFLAGS"
--extra-ldflags="$ADDI_LDFLAGS"
$ADDITIONAL_CONFIGURE_FLAG
make clean
make
make install
}
CPU=arm
PREFIX=$(pwd)/android/$CPU
ADDI_CFLAGS="-marm"
build_one
Once the file is saved, go to the directory where this file lies & execute the command below,
sudo chmod +x build_android.sh
Then execute the script by the command,
./build_android.sh
Build Output : The build can take a while to finish depending on your computer speed. Once it’s done, you should be able to find a folder $NDK/sources/ffmpeg-3.1.1/android, which contains arm/lib and arm/include folders.
.o
、.d
、make 文件等文件夹。如何获取 .so
文件呢? - Volodymyr Kulykhttp://androidwarzone.blogspot.in/2011/12/ffmpeg4android.html
http://writingminds.github.io/ffmpeg-android-java/
https://androiddeveloperhelp.wordpress.com/2015/12/19/video-editing-android-example/
知识方面:
http://www.lai18.com/content/5175900.html
Android studio源代码:
https://drive.google.com/file/d/0B9qAjo6wKhk9MEpNNjMxaG5oWXM/view?usp=sharing
希望这些内容可以帮到你。
你是否看到了这个链接Writingminds提供的FFmpeg库,所有解释都在这个链接中。
如果您想使用任何库的最新版本,可以直接从build.gradle
中进行,因为如果任何库未更新,则可以从build.gradle
中查看并更新,我总是为许多库执行此操作以获取最新可用版本。
对于FFMpeg中的gradle,请使用以下内容
compile 'com.writingminds:FFmpegAndroid:0.3.2'
这个链接提供了更多类似的库https://android-arsenal.com/details/1/925
如果要添加本地代码,则这些博客可能会对您有所帮助
http://ffmpeg-android.blogspot.in/ 和
http://www.roman10.net/2011/07/17/how-to-build-android-applications-based-on-ffmpeg-by-an-example/
我已经使用过几周的Android ffmpeg。
这个库叫做FFmpeg4Android,可以在 WarZone找到。
我知道标题说的是2011年12月6日,但我已经测试并且它运行得非常顺畅。你没有提及你对这个库的确切需求,但你可以在官方网站上了解ffmpeg的能力。
FFmpeg4Android有一个示例项目,可以作为很好的参考,而且他们的支持非常迅速和清晰。
命令根据您的字符串输入运行,例如:
ffmpeg -y -i /sdcard/videokit/in.mp4 -strict experimental -s 160x120 -r 25 -vcodec mpeg4 -b 150k -ab 48000 -ac 2 -ar 22050 /sdcard/videokit/out.mp4
如果需要进一步帮助,请告诉我,我很乐意帮忙。
FFMPEG
最新版本是什么意思?我的意思是,最新版本和你上面提供的链接有什么区别。我已经使用过FFMPEG
Android并成功地创建了许多视频..!! - Janki Gadhiya