简体   繁体   English

如何集成android项目中的FFMPEG NDK库以解码音频文件?

[英]How to intergrate FFMPEG NDK library in android project to decode the audio files?

How to decode the audio files using FFMPEG NDK library? 如何使用FFMPEG NDK库解码音频文件? Below is the code i used to decode the mp3 file after merging two mp3 files. 下面是合并两个mp3文件后用于解码mp3文件的代码。 try { 尝试{

            String tempPath = Environment.getExternalStorageDirectory()+"/"+mvalue+".mp3";

            File fileTemp = new File(tempPath);

            ffmpeg = new FfmpegController(fileTemp,outFile);


            Clip clipMixOut = new Clip(outFile.getCanonicalPath());

            try {
                ffmpeg.convertToMPEG(clipMixOut,mCodecPath, new ShellUtils.ShellCallback() {

                    @Override
                    public void shellOut(String shellLine) {
                        // TODO Auto-generated method stub
                        System.out.println("fc>" + shellLine);

                    }

                    @Override
                    public void processComplete(int exitValue) {
                        // TODO Auto-generated method stub
                        System.err.println("concat non-zero exit: " + exitValue);

                    }
                });
            } catch (Exception e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }

        } catch (IOException e) {
            Log.e(TAG+":::", "IOException running ffmpeg" + e.getMessage());
        }

I resolved this issue by regenerating a SO file. 我通过重新生成SO文件解决了此问题。 Then everything is working fine just by calling: 然后,只需调用以下命令,一切就可以正常工作:

process.exec("ffmpeg cmd");

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

相关问题 如何在Android中通过FFmpeg解码音频 - How to decode audio via FFmpeg in Android 带有ffmpeg库的Android NDK-运行项目时出错 - Android NDK w/ ffmpeg library - error running project Eclipse,Android NDK,源文件和库项目依赖项 - Eclipse, Android ndk, source files, and library project dependencies 初学者| 如何使用Android项目(也许是NDK)库中的.jar和.so文件? - Beginner | How can i use .jar and .so files from a library for an Android project (maybe NDK)? 当本机共享库依赖静态库时,如何将基于Android.mk文件的Android NDK项目迁移到Gradle? - How to migrate an Android NDK project based on Android.mk files to Gradle when a native shared library depends on a static library? 包括带有 Android NDK 的库文件 - Including library files with Android NDK 一个没有 Android 项目的 Android NDK 库如何 - How does one Android NDK library without a Android Project 需要帮助配置ffmpeg以使用android ndk解码原始AAC - need help configuring ffmpeg to decode raw AAC with android ndk 如何将预建的共享库链接到Android NDK项目? - How to link a prebuilt shared Library to an Android NDK project? 使用最新的FFmpeg库和NDK在Android中编译简单库的错误 - Compile error for a simple library in Android using latest FFmpeg library with NDK
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM