简体   繁体   English

针对Android的预编译FFmpeg与使用android NDK构建FFmpeg

[英]Precompiled FFmpeg for android versus building FFmpeg using android NDK

I am building an android app which does some video processing. 我正在构建一个进行视频处理的android应用。

I am currently using precompiled FFmpeg from https://github.com/writingminds/ffmpeg-android . 我目前正在使用https://github.com/writingminds/ffmpeg-android的预编译FFmpeg。 The other option is to download FFmpeg source code and compile it using Android NDK. 另一个选择是下载FFmpeg源代码并使用Android NDK对其进行编译。 The reason I am contemplating option 2 is to enhance performance. 我考虑选项2的原因是为了提高性能。 My questions are 我的问题是

  1. Is there a difference between the two options mentioned above? 上面提到的两个选项之间有区别吗?

  2. If yes, what would be the difference. 如果是,那会有什么区别。 Would it be enhanced performance (or) the result would simply be the same (or) are there some other benefits or drawbacks? 是否会提高性能(或)结果将完全相同(或)是否存在其他优点或缺点?

  3. When they state precompiled FFmpeg, does it mean it was compiled using Android NDK for a specific architecture? 当他们声明预编译的FFmpeg时,是否表示它是使用Android NDK针对特定架构进行编译的?

Please let me know. 请告诉我。

Thank you in advance!!! 先感谢您!!!

There can be a big difference in performance 性能可能会有很大差异

The main issue is that the binary you linked to uses --disable-asm in the x264 configuration. 主要问题是链接到的二进制文件在x264配置中使用--disable-asm This option disables platform-specific assembly optimizations and results in a significant decrease in H.264 encoding speed (when encoding via libx264 in ffmpeg). 此选项禁用特定于平台的程序集优化,并导致H.264编码速度显着降低(在ffmpeg中通过libx264编码时)。 I'm unsure why this option is used by the binary provider. 我不确定二进制提供程序为什么使用此选项。

When using ffmpeg refer to the console output. 使用ffmpeg时,请参考控制台输出。 If it shows [libx264] using cpu capabilities: none! 如果显示[libx264] using cpu capabilities: none! then your encoding speed is not optimal and will be unecessarily slower. 则您的编码速度不是最佳的,并且会不必要地降低速度。 For reference, Android users should typically see something like NEON ARMv7 or similar instead of none . 作为参考,Android用户通常应该看到类似NEON ARMv7或类似内容,而不是none

Avoid this misconfigured binary. 避免配置错误的二进制文件。 Properly compiling it yourself will allow you to take advantage of ASM optimizations, and therefore encode faster. 自己正确地编译它可以使您利用ASM优化,从而加快编码速度。

ffmpeg can be built with very different options. 可以使用非常不同的选项来构建ffmpeg。 Some components may be disabled, and this may reduce the size of the binaries significantly. 某些组件可能被禁用,这可能会大大减小二进制文件的大小。 The prebuilt binaries in https://github.com/writingminds include the GPL components, eg x264 encoder. https://github.com/writingminds中的预编译二进制文件包含GPL组件,例如x264编码器。 This means that you may have legal problems using it in your app, unless it is opensource. 这意味着,除非它是开源的,否则在您的应用程序中使用它可能会有法律问题。 Note that I am not a loyer, so don't hesitate to consult with a professional. 请注意,我不是雇主,所以请随时与专业人士协商。

Another issue to consider when in doubt about using prebuilt binaries, is that this is a monolithic binary. 在对使用预构建的二进制文件有疑问时要考虑的另一个问题是,这是一个整体式二进制文件。 If you need some specific functionality from ffmpeg, it may build a custom library based on ffmpeg libraries (libavcodec, libavformat, etc). 如果您需要ffmpeg的某些特定功能,它可能会基于ffmpeg库(libavcodec,libavformat等)构建自定义库。 This advantage is negligible if you use ffmpeg to convert long video files, but if you must work on many small chunks of data, the overhead may be significant. 如果使用ffmpeg转换长视频文件,则此优势可以忽略不计,但如果必须处理许多小数据块,则开销可能会很大。 You can find prebuilt libraries for Android, too. 您也可以找到Android的预构建库。

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

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