-- 一个只会使用java的男人
一、安装ffmpeg
下载地址:http://ffmpeg.org/download.html
二、转换程序(m4a转wav格式)
/**
* @param sourcePath eg:F://tmp/m4a/aa.m4a
* @param targetPath eg:F://tmp/wav/bb.wav;
* @param webroot ffmpeg安装路径 eg: D:\\soft\\ffmpeg\\bin
*/
private static void convert(String source, String target, String webroot) {
Runtime run = null;
try {
run = Runtime.getRuntime();
Process p = run.exec(new File(webroot).getAbsolutePath() + "/ffmpeg -y -i " + sourcePath + " " + targetPath);
p.getOutputStream().close();
p.getInputStream().close();
p.getErrorStream().close();
p.waitFor();
} catch (Exception e) {
e.printStackTrace();
} finally {
run.freeMemory();
}
}