amr转opus
@Component(“amr2opus”)
public class Amr2OpusCodec{
@Value("${tmp.dir}")
private String tmpDirString;
@Value("${tools.dir}")
private String toolDirString;
public File encode(String fileMd5Name) {
//ffmpeg -i ${in}.amr -c:a libopus -ac 1 -ar 8000 -b:a 16K -y &{out}.opus
String cmd = toolDirString+"/ffmpeg"+OSUtil.getSuffix()+" -v 0 -i "+tmpDirString+"/"+fileMd5Name+" -c:a libopus -ac 1 -ar 8000 -b:a 16K -y "+tmpDirString+"/"+fileMd5Name+".opus";
ProcessUtil.executeCmd(cmd);
return new File(tmpDirString, fileMd5Name + ".opus");
}
}
opus转amr
@Component(“opuc2amr”)
public class Opus2AmrCodec{
@Value("${tmp.dir}")
private String tmpDirString;
@Value("${tools.dir}")
private String toolDirString;
public File encode(String fileMd5Name) {
//ffmpeg -i ${in}.opus -c:a libopencore_amrnb -ac 1 -ar 8000 -b:a 7.95K -y ${out}.amr
String cmd = toolDirString+"/ffmpeg"+OSUtil.getSuffix()+" -v 0 -i "+tmpDirString+"/"+fileMd5Name+" -c:a libopencore_amrnb -ac 1 -ar 8000 -b:a 7.95K -y "+tmpDirString+"/"+fileMd5Name+".amr";
ProcessUtil.executeCmd(cmd);
return new File(tmpDirString, fileMd5Name + ".amr");
}
}