适用于Mac的JAVE Library

时间:2017-03-17 09:54:00

标签: java jave

我实际上是想在我的Mac上启动我的Unix代码。 我知道我必须在我的Mac上构建ffmpeg。

我使用了Github脚本:

Script

我的代码:

package test1;
import it.sauronsoftware.jave.*;
import test1.MyFFMPEGExecutableLocator;

import java.io.*;
public class Test1 {
    public static void main (String[] zero) throws IllegalArgumentException, InputFormatException, EncoderException{
        File source = new File("/Users/Mokeight/Desktop/Test2.mp3");

        File target = new File("/Users/Mokeight/Desktop/target2.wav");

        System.out.println("START");

        AudioAttributes audio = new AudioAttributes();
        EncodingAttributes attrs = new EncodingAttributes();

        //codec de wav

        audio.setCodec("pcm_s16le");
        attrs.setFormat("wav");
        attrs.setAudioAttributes(audio);

        //System.out.println(new MyFFMPEGExecutableLocator().toString());
        Encoder encoder = new Encoder(new MyFFMPEGExecutableLocator());


        encoder.encode(source, target, attrs);


        System.out.println("END");


    }
}

我的第二堂课是:

package test1;

import it.sauronsoftware.jave.FFMPEGLocator;

public class MyFFMPEGExecutableLocator extends FFMPEGLocator{
    @Override
    protected String getFFMPEGExecutablePath() {
        // TODO Auto-generated method stub
        String path = "/Users/Mokeight/Desktop/ffmpeg_mac/ffmpeg-build/workspace/bin/ffmpeg" ;  
        return path;

    }
}

当我正在运行时,我有这个错误:

START
Exception in thread "main" it.sauronsoftware.jave.EncoderException:   Metadata:
    at it.sauronsoftware.jave.Encoder.encode(Encoder.java:863)
    at it.sauronsoftware.jave.Encoder.encode(Encoder.java:713)
    at test1.Test1.main(Test1.java:27)

请帮助

谢谢!!

0 个答案:

没有答案