for(long i=0,j=0;i<(long)length;i+=60,j++){
try {
Process process = Runtime.getRuntime().exec("\"F:\\Program Files\\mplayer\\mencoder.exe\" -ss "+i+" -endpos 60 \""+path+"\" -o \""+temppath+File.separator+j+".flv\" -of lavf -lavfopts i_certify_that_my_video_stream_does_not_use_b_frames -oac mp3lame -lameopts abr:br=56 -ovc lavc -lavcopts vcodec=flv:vbitrate=400:mbd=0:mv0:trell:v4mv:cbp:last_pred=0:dia=-60:cmp=0:vb_strategy=1 -vf scale=320:-3 -ofps 12 -srate 22050");
process.waitFor();
process.destroy();
} catch (IOException ex) {
ex.printStackTrace();
}catch (InterruptedException ex) {
ex.printStackTrace();
}代码如上……
如果加了process.waitFor()的话……则mencoder被挂起……
如果不加process.waitFor()的话……则不等当前mencoder执行完,下一个mencoder就开始执行了……问:怎么能让一个mencoder完成后,下一个mencoder才运行???
try {
Process process = Runtime.getRuntime().exec("\"F:\\Program Files\\mplayer\\mencoder.exe\" -ss "+i+" -endpos 60 \""+path+"\" -o \""+temppath+File.separator+j+".flv\" -of lavf -lavfopts i_certify_that_my_video_stream_does_not_use_b_frames -oac mp3lame -lameopts abr:br=56 -ovc lavc -lavcopts vcodec=flv:vbitrate=400:mbd=0:mv0:trell:v4mv:cbp:last_pred=0:dia=-60:cmp=0:vb_strategy=1 -vf scale=320:-3 -ofps 12 -srate 22050");
process.waitFor();
process.destroy();
} catch (IOException ex) {
ex.printStackTrace();
}catch (InterruptedException ex) {
ex.printStackTrace();
}代码如上……
如果加了process.waitFor()的话……则mencoder被挂起……
如果不加process.waitFor()的话……则不等当前mencoder执行完,下一个mencoder就开始执行了……问:怎么能让一个mencoder完成后,下一个mencoder才运行???
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货