|
@ -254,29 +254,4 @@ public class CommonUtil {
|
|
|
|
|
|
return fileUrls;
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 将上传的录音转为mp3格式
|
|
|
* @param sourcePath 文件的相对地址
|
|
|
*/
|
|
|
public static void changeToMp3(String sourcePath, String targetPath) {
|
|
|
File source = new File(sourcePath);
|
|
|
File target = new File(targetPath);
|
|
|
AudioAttributes audio = new AudioAttributes();
|
|
|
Encoder encoder = new Encoder();
|
|
|
audio.setCodec("libmp3lame");
|
|
|
EncodingAttributes attrs = new EncodingAttributes();
|
|
|
attrs.setFormat("mp3");
|
|
|
attrs.setAudioAttributes(audio);
|
|
|
try {
|
|
|
encoder.encode(source, target, attrs);
|
|
|
} catch (IllegalArgumentException e) {
|
|
|
e.printStackTrace();
|
|
|
} catch (InputFormatException e) {
|
|
|
e.printStackTrace();
|
|
|
} catch (EncoderException e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
}
|
|
|
}
|