我想创建一个将视频转换为音频的软件。我为此使用 PROCESSING (JAVA) 和 JAVE。我的问题是“ it.sauronsoftware.jave.InputFormatException
”,此代码可以运行,Windows
但不能在OSX
.
我认为这可能是权限问题。
String pathVideo="/Users/nouv/Desktop/video1";
String pathAudioTmp="/Users/nouv/Desktop/son";
void setup() {
size(200, 200);
try {
File source = new File(pathVideo);
File target = new File(pathAudioOutput);
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();
encoder.encode(source, target, attrs);
}
catch (Exception e)
{
e.printStackTrace();
println(e);
}