得到一个错误,而在Android项目中使用JAVE库 [英] Getting an error while using JAVE library in an Android project

查看:1284
本文介绍了得到一个错误,而在Android项目中使用JAVE库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的是被称为 JAVE 在我的Andr​​oid项目的外部库为了从视频文件中提取音频。

I'm using an external library called JAVE in my Android project in order to extract the audio from a video file.

我的code:

 public void extractAudio() {
    File source = new File(Environment.getExternalStorageDirectory().getPath() + "/test.flv");
    File target = new File(Environment.getExternalStorageDirectory().getPath() + "/test.mp3");
    AudioAttributes audio = new AudioAttributes();
    audio.setCodec("libmp3lame");
    audio.setBitRate(new Integer(128000));
    audio.setChannels(new Integer(2));
    audio.setSamplingRate(new Integer(44100));
    EncodingAttributes attrs = new EncodingAttributes();
    attrs.setFormat("mp3");
    attrs.setAudioAttributes(audio);
    Encoder encoder = new Encoder();
    try {
        encoder.encode(source, target, attrs);
    } catch (IllegalArgumentException e) {
        e.printStackTrace();
    } catch (InputFormatException e) {
        e.printStackTrace();
    } catch (EncoderException e) {
        e.printStackTrace();
    }
}

这是我得到的错误:

These are the errors I get:

11-09 18:26:49.874: W/System.err(6594): java.io.IOException: Error running exec(). Command: [/bin/chmod, 755, /sdcard/jave-1/ffmpeg] Working Directory: null Environment: null
11-09 18:26:49.874: W/System.err(6594):     at java.lang.ProcessManager.exec(ProcessManager.java:211)
11-09 18:26:49.874: W/System.err(6594):     at java.lang.Runtime.exec(Runtime.java:168)
11-09 18:26:49.884: W/System.err(6594):     at java.lang.Runtime.exec(Runtime.java:123)
11-09 18:26:49.884: W/System.err(6594):     at it.sauronsoftware.jave.DefaultFFMPEGLocator.<init>(DefaultFFMPEGLocator.java:85)
11-09 18:26:49.884: W/System.err(6594):     at it.sauronsoftware.jave.Encoder.<init>(Encoder.java:111)
11-09 18:26:49.884: W/System.err(6594):     at com.yt.ringtones.RipActivity.extractAudio(RipActivity.java:236)
11-09 18:26:49.894: W/System.err(6594):     at com.yt.ringtones.RipActivity$1$DownloadFromUrl.onPostExecute(RipActivity.java:94)
11-09 18:26:49.894: W/System.err(6594):     at com.yt.ringtones.RipActivity$1$DownloadFromUrl.onPostExecute(RipActivity.java:1)
11-09 18:26:49.894: W/System.err(6594):     at android.os.AsyncTask.finish(AsyncTask.java:602)
11-09 18:26:49.894: W/System.err(6594):     at android.os.AsyncTask.access$600(AsyncTask.java:156)
11-09 18:26:49.986: W/System.err(6594):     at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:615)
11-09 18:26:49.986: W/System.err(6594):     at android.os.Handler.dispatchMessage(Handler.java:99)
11-09 18:26:49.986: W/System.err(6594):     at android.os.Looper.loop(Looper.java:137)
11-09 18:26:49.994: W/System.err(6594):     at android.app.ActivityThread.main(ActivityThread.java:4424)
11-09 18:26:49.994: W/System.err(6594):     at java.lang.reflect.Method.invokeNative(Native Method)
11-09 18:26:49.994: W/System.err(6594):     at java.lang.reflect.Method.invoke(Method.java:511)
11-09 18:26:50.014: W/System.err(6594):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
11-09 18:26:50.014: W/System.err(6594):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
11-09 18:26:50.024: W/System.err(6594):     at dalvik.system.NativeStart.main(Native Method)
11-09 18:26:50.024: W/System.err(6594): Caused by: java.io.IOException: No such file or directory
11-09 18:26:50.024: W/System.err(6594):     at java.lang.ProcessManager.exec(Native Method)
11-09 18:26:50.034: W/System.err(6594):     at java.lang.ProcessManager.exec(ProcessManager.java:209)

我是相当新的Andr​​oid开发,我真的不知道这里有什么问题。我倒是AP preciate任何帮助。

I'm rather new to Android development and I'm not really sure what's the problem here. I'd appreciate any help.

推荐答案

EXEC()基本上是一个系统执行命令,如果你想从一个命令行运行它。它试图运行/ SD卡/ java的-1 / ffmpeg的,这应该是一个可执行文件。你有你的设备上这个可执行文件?如果不是,这是行不通的。

"exec()" basically executes a command in a system, as if you would run it from a command line. It is trying to run "/sdcard/jave-1/ffmpeg", which is supposed to be an executable file. Do you have this executable on your device? If not, this will not work.

这篇关于得到一个错误,而在Android项目中使用JAVE库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆