process.waitFor()挂起的问题
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才运行???
------解决方案--------------------关注,顶