到CSDN下载ffmpeg和mencoder命令使用的总结(超级全面)
两个程序
package national;
import javautilArrayList;
import javautilList;
public class VideoProcess {
public static boolean processTransToImg(String oldfilepathString newfilenameString
newimg){
Systemoutprintln(oldfilepath+>+newfilename+
>+newimg);
List<String> commendF = new ArrayList<String>();
List<String> commendI=new javautilArrayList<String>();
commendFadd(F://mencoder//summer//mencoder);
commendFadd(oldfilepath);
commendFadd(o);
commendFadd(newfilename);
commendFadd(of);
commendFadd(lavf);
commendFadd(oac);
commendFadd(mplame);
commendFadd(lameopts);
commendFadd(abr:br=:vol=);
commendFadd(srate);
commendFadd();
commendFadd(ovc);
commendFadd(lavc);
commendFadd(lavcopts);
commendFadd
(vcodec=flv:vbitrate=:mbd=:vmv:turbo:vb_strategy=:last_pred=:trell);
commendFadd(vf);
commendFadd(scale=:);
commendIadd(F://mencoder//summer//ffmpegexe);
commendIadd(i);
commendIadd(oldfilepath);
commendIadd(y);
commendIadd(f);
commendIadd(image);
commendIadd(ss);
commendIadd();
commendIadd(t);
commendIadd();
commendIadd(s);
commendIadd(x);
commendIadd(newimg);
try {
ProcessClassexec(commendF);
ProcessClassexec(commendI);
return true;
} catch (Exception e) {
eprintStackTrace();
return false;
}
}
public static void main(String[] args){
String oldfilepath = f://shanghaitanrm;
String newfilename = f://shanghaitanflv;
String newimg = f://shanghaitanjpg;
Systemoutprintln();
processTransToImg(oldfilepathnewfilenamenewimg);
Systemoutprintln(over);
}
}
package national;
import javaioIOException;
import javautilArrayList;
import javautilIterator;
import javautilList;
public class ProcessClass{
public List<String> commendList = new ArrayList<String>();
public ProcessClass(List<String> commendList){
mendList = commendList;
}
//同步使只能有一个进程执行该方法(实现格式转换进程完成后执行截图进程操作)
public static synchronized Process exec(List<String> commendlist){
StringBuffer strBuf = new StringBuffer();
for(Iterator iter =erator();iterhasNext(); ){
String Strtemp = (String)iternext();
strBufappend(Strtemp);
strBufappend( );
}
try {
return RuntimegetRuntime()exec(strBuftoString());
} catch (IOException e) {
eprintStackTrace();
return null;
}
}
}