1

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

我为此使用了 Github 脚本:

脚本

我的代码:

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)

请帮忙

谢谢 !!

4

0 回答 0