简体   繁体   English

如何在Android中构建和使用ffmpeg

[英]How to build and use ffmpeg within android

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. 我正在制作一个相当简单的相机应用程序的原型,以使用MediaRecorder进行测试以创建带有一个障碍的自定义相机活动,我想将录制视频的纵横比设置为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. 通过大量研究,我发现只有通过使用FFMPEG之类的库将视频的每一帧裁剪到所需的大小,才有可能。

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. 我已经阅读了许多关于将FFMPEG内置到Android中的不同方式的教程和文章,但是其中大多数已经过时,并且使用了Android NDK和FFMPEG的较旧版本,或者更新的版本在遵循时不起作用。 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. 我尝试遵循流行的http://www.roman10.net/how-to-build-ffmpeg-for-android/以及其他一些类似的方法,这些方法均会导致有关丢失的pkg-config文件的错误,因为FFMPEG是通常显然是要安装在Linux或其他操作系统上。 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. 我在http://software.intel.com/zh-CN/android/blogs/2013/12/06/building-ffmpeg-for找到了一些有关通过使用make-standalone-toolchain.sh文件在android中构建FFMPEG的信息。 -android-on-x86上 ,关于使用此方法的方法,我们无能为力

This now leads into my question: What is the best/proven way currently to build and use FFMPEG within android applications? 现在,这引出我的问题:在android应用程序中构建和使用FFMPEG的最佳/成熟方法是什么? 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); 我什至对FFMPEG库已经准备就绪的可靠模板应用程序持开放态度(如果可能的话); although, I would much rather know how to build this into android for future use. 虽然,我宁愿知道如何将其构建到android中以供将来使用。

Thank you in advance for any advice or suggestions on this issue. 预先感谢您对这个问题的任何建议。

I have successfully build ffmpeg libraries using 我已经成功使用构建了ffmpeg库

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

You have to be on Ubuntu to build that. 您必须在Ubuntu上进行构建。

This is the guide I liked the most: http://www.roman10.net/how-to-build-ffmpeg-with-ndk-r9/ 这是我最喜欢的指南: 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 ). 编辑:我用更新的文章更新了第一个链接(它使用NDK r9 )。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM