安卓上MP3怎么转amr?
安卓开发里面怎么把mp3文件转为amr文件
使用jave 报错
public static boolean Mp3ToAmr(String srcname, String targetname)
{
File source = new File(srcname); //源文件
File target = new File(targetname); //目标文件
AudioAttributes audio = new AudioAttributes();
audio.setCodec("libmp3lame");
EncodingAttributes attrs = new EncodingAttributes();
attrs.setFormat("mp3");
attrs.setAudioAttributes(audio);
Encoder encoder = new Encoder();
try {
encoder.encode(source, target, attrs);
return true;
} catch (IllegalArgumentException | EncoderException e) {
e.printStackTrace();
}
return false;
}