简体   繁体   English

如何在Android Studio中使用预建的FFmpeg

[英]How to use prebuilt FFmpeg in Android Studio

I'm sure this is a very basic question but since this is the my first time messing around with the NDK, a lot of thing is still very unclear to me. 我确信这是一个非常基本的问题,但是由于这是我第一次与NDK纠缠不清,所以很多事情对我来说仍然很不清楚。

Use case: 用例:

  • I'm trying to develop a video scrubbing feature so fast and accurate frame seeking is crucial. 我正在尝试开发视频清理功能,因此快速准确的寻帧至关重要。 I've tried most of the available players out there but the performance is still not up to my demand. 我已经尝试了大多数可用的播放器,但性能仍达不到我的要求。 That's why I'm going down the FFmpeg route. 这就是为什么我要走FFmpeg路线的原因。

  • Basically, what I'm looking for is FFmpeg input seeking . 基本上,我要寻找的是FFmpeg输入寻找 I've tried WrtingMinds' ffmpeg-android-java . 我已经尝试过WrtingMinds的ffmpeg-android-java However it is a file based implementation which means the out.jpg need to be written to external memory and read back which has a big hit on performance (roughly 1000 milliseconds for 1 seek). 但是,这是基于文件的实现,这意味着out.jpg需要写入外部存储器并回读,这对性能有很大的影响(一次搜索大约需要1000毫秒)。

  • That's why I'm trying to built my own FFmpeg player to do the input seeking in JNI and push back the byte[] to be displayed in Java. 这就是为什么我试图构建自己的FFmpeg播放器以在JNI中进行输入搜索并向后推byte[]以在Java中显示的原因。

Question: After a lot of struggling with the NDK, I've managed to set it up and successfully calling the JNI method from my Java code. 问题:经过NDK的大量努力之后,我设法进行了设置,并成功从Java代码中调用了JNI方法。 The structure is as below: 结构如下:

MyApp
  -app
  -MyFFmpegPlayer
    -build
    -libs
    -src
      -main
        -java
          -com.example.myffmpegplayer
            +HelloJNI.java
        -jni
          +MyFFmpegPlayer.c

After some fail attempt to build FFmpeg on Windows, I've decided to use WritingMinds prebuilt FFmpeg. 在Windows上无法成功构建FFmpeg之后,我决定使用WritingMinds预先构建的FFmpeg。 However, after extraction they just come up as plain ffmpeg files (not .so file) so I don't really know how to use these. 但是,提取后它们只是以纯ffmpeg文件(而不是.so文件)形式出现,所以我真的不知道如何使用这些文件。

It would be a great gratitude, if someone can just chime in and give me a good starting point for my next step. 如果有人可以插话并为下一步提供一个良好的起点,那将是极大的感谢。

Thank you so much for your time. 非常感谢您的参与。

So to answer my own question which I should change to "How to build FFmpeg and use it with Android Studio", I have create a detail step-by-step instruction that's working for me (at May 24th 2016 ). 因此,为了回答我自己的问题(我应该改为“如何构建FFmpeg并在Android Studio中使用它”),我创建了一条适用于我的详细分步说明( 截至2016年5月24日 )。

Sorry I can't post the whole instruction here as it is very long, plus it is easier for me to keep 1 source of information up-to-date. 抱歉,由于篇幅太长,我无法在此处发布整个说明,而且我更容易保持1个信息源的最新状态。

I hope this can help someone as I know there is way too much confusing and contradicting information regarding this topic out there. 我希望这可以对某人有所帮助,因为我知道关于该主题的信息太多,令人困惑和矛盾。

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

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