/*
code by rogerlee qq:1036225989
*/
public class Wav2mp3 {
public static void main(String[] args) {
String srcFileName="1.wav";
String tarFileName="1.mp3";
Runtime run=null;
try{
run=Runtime.getRuntime();
long start=System.currentTimeMillis();
Process p=run.exec("lame -b 16 "+srcFileName+" "+tarFileName); //16为码率,可自行修改
//important
p.getOutputStream().close();
p.getInputStream().close();
p.getErrorStream().close();
p.waitFor();
long end=System.currentTimeMillis();
System.out.print("convert costs:"+(end-start));
}
catch(Exception err){
err.printStackTrace();
}
finally{
if(run!=null){
run.freeMemory();
}
}
}
}
在java程序中实现wav文件转MP3
4星 · 超过85%的资源 需积分: 32 155 浏览量
2010-10-28
16:34:40
上传
评论 3
收藏 282KB RAR 举报
newsysway
- 粉丝: 0
- 资源: 2
- 1
- 2
- 3
- 4
- 5
- 6
前往页