我正在尝试将扩展名为.vox的音频文件转换为.mp3,我需要使用Java进行此操作。我尝试使用JAVE库,可以将wav转换为mp3,但是 我无法使用.vox。
public static void main(String[] args) {
// TODO Auto-generated method stub
try {
System.out.println("Luis Pavez");
File source = new File("C:\\audios\\origen\\audio.vox");
File target = new File("C:\\audios\\origen\\valiente.mp3");
AudioAttributes audio = new AudioAttributes();
audio.setCodec("libmp3lame");//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 (IllegalArgumentException | EncoderException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
错误
it.sauronsoftware.jave.InputFormatException: could not find codec parameters
at it.sauronsoftware.jave.Encoder.parseMultimediaInfo(Encoder.java:532)
at it.sauronsoftware.jave.Encoder.encode(Encoder.java:840)
at it.sauronsoftware.jave.Encoder.encode(Encoder.java:713)
at Convertidor.main(Convertidor.java:30)
还有另一种方法吗?