阅读更多
public static void getThumb() throws IOException,
InterruptedException {
//ffmpeg -re -i /Users/samson/Desktop/apple-iphone4-design_video-us-20100607_848x480.mov -vcodec copy -f flv rtmp://localhost:1935/live1/room2
ProcessBuilder processBuilder = new ProcessBuilder("ffmpeg",
"-re","-i", "/Users/samson/Desktop/apple-iphone4-design_video-us-20100607_848x480.mov",
"-vcodec", "copy" ,
"-f", "flv","rtmp://localhost:1935/live1/room2");
Process process = processBuilder.start();
InputStream stderr = process.getErrorStream();
InputStreamReader isr = new InputStreamReader(stderr);
BufferedReader br = new BufferedReader(isr);
String line;
while ((line = br.readLine()) != null) ;
process.waitFor();
if (br != null)
br.close();
if (isr != null)
isr.close();
if (stderr != null)
stderr.close();
}
public static void main(String[] args) {
try {
getThumb();
} catch (IOException e) {
e.printStackTrace();
} catch (InterruptedException e) {
e.printStackTrace();
}
}