日期:2014-05-17 浏览次数:20830 次
Process process = null;
try {
String raw2flvCmd = "/usr/local/ffmpeg/bin/ffmpeg -i \"某视频文件下载URL\" -f flv /usr/userfile/ffmpeg/tempfile/1.flv";
process = Runtime.getRuntime().exec(new String[]{"sh","-c",raw2flvCmd});
StreamGobbler errorGobbler = new StreamGobbler(process.getErrorStream(), "ERROR");
errorGobbler.start();// kick off stderr
StreamGobbler outGobbler = new StreamGobbler(process.getInputStream(), "STDOUT");
outGobbler.start();// kick off stdout
process.waitFor();
} catch (Exception e) {
//do some thing
}