熱點推薦:
您现在的位置: 電腦知識網 >> 編程 >> Java編程 >> Java核心技術 >> 正文

java上傳視頻截圖

2022-06-13   來源: Java核心技術 

  到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;

  }

  }

  }


From:http://tw.wingwit.com/Article/program/Java/hx/201311/26925.html
    推薦文章
    Copyright © 2005-2022 電腦知識網 Computer Knowledge   All rights reserved.