解决方案 »
- 在线等 求解 mybatis 动态sql语句 choose和if 一起用时,为什么只执行otherwise里面的Sql语句 求解
- linux tomcat虚拟路径
- 小弟初学JAVA,想学习分页
- eclipse+myeclipse+ tomcat 运行jsp的初级问题
- java.sql.SQLException: No suitable driver
- 为什么我把List results = query.list(); 放到一个循环里执行几次后 就像卡住了 不执行了 怎么回事
- 一个没想通的问题
- 一个关于参数传递的简单问题
- 我用tomcat +jdk1.2,怎么把jdk升级到1。4呢!
- 如何查询出订单的信息和订单中包含的商品详细信息(一个订单有多个商品)该怎么写SQL语句
- 求教:struts1中jsp页面如何传递list给action?
- 求助,ssh报java.lang.ExceptionInInitializerError
StreamGobbler errorGobbler = new StreamGobbler(process.getErrorStream(), "ERROR");
errorGobbler.start();// kick off stderr
StreamGobbler 源码:
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter; public class StreamGobbler extends Thread {
InputStream is;
String type;
OutputStream os; public StreamGobbler(InputStream is, String type) {
this(is, type, null);
} public StreamGobbler(InputStream is, String type, OutputStream redirect) {
this.is = is;
this.type = type;
this.os = redirect;
} @Override
public void run() {
PrintWriter pw = null;
InputStreamReader isr = null;
BufferedReader br = null;
try {
if (os != null)
pw = new PrintWriter(os); isr = new InputStreamReader(is);
br = new BufferedReader(isr);
String line = null;
while ((line = br.readLine()) != null) {
if (pw != null)
pw.println(line);
//System.out.println(type + ">" + line);
}
if (pw != null)
pw.flush();
} catch (IOException ioe) {
ioe.printStackTrace();
} finally {
if (pw != null) {
pw.close();
}
if (br != null) {
try {
br.close();
} catch (IOException e) {
e.printStackTrace();
}
}
if (isr != null) {
try {
isr.close();
} catch (IOException e) {
e.printStackTrace();
}
}
if (os != null) {
try {
os.close();
} catch (IOException e) {
e.printStackTrace();
}
}
if (is != null) {
try {
is.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
}
String raw2flvCmd = "/usr/local/ffmpeg/bin/ffmpeg -i \"某视频文件下载URL\" -f flv /usr/userfile/ffmpeg/tempfile/1.flv";
Runtime.getRuntime().exec(new String[]{"sh","-c",raw2flvCmd});
你按照自己的 CMD,改一下就可以了。