import java.io.IOException; public class TestMencoder { public static void main(String[] args) { String outPath="e:\\output\\o1.flv"; //输出的文件路径 String inPath="e:\\74.2.mpg"; //要转换的视频文件路径 String cmd4="e:\\test_par.bat " + inPath+ " "+outPath; try { Process pr=Runtime.getRuntime().exec(cmd4); pr.getInputStream(); System.out.println(cmd4); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }
以下为test_par.bat的内容, %1 为第一个参数,%2为第二个参数
cmd /c start D:\foresee\workspace3.2\rr\ffmpeg\ffmpeg.exe -i %1 -y -ab 32 -ar 11025 -b 400000 -s 320*240 %2 echo 完成! echo. & pause