Java Upload Video screenshot

Source: Internet
Author: User

1, to csdn Download: summary of the use of FFmpeg and MEncoder commands (Super Comprehensive)

2, two programs:

Package national;
Import java.util.ArrayList;
Import java.util.List; public class Videoprocess {public static Boolean processTransToImg2 (String oldfilepath,string newfilename,string newimg
       ) {System.out.println (oldfilepath+ "->" +newfilename+ "->" +newimg);
       list<string> commendf = new arraylist<string> ();
       List<string> commendi=new java.util.arraylist<string> ();
       Commendf.add ("F://mencoder//summer//mencoder");
       Commendf.add (Oldfilepath);
       Commendf.add ("-O");
       Commendf.add (NewFileName);
       Commendf.add ("-of");
       Commendf.add ("Lavf");
       Commendf.add ("-oac");
       Commendf.add ("Mp3lame");
       Commendf.add ("-lameopts");
       Commendf.add ("abr:br=32:vol=1");
       Commendf.add ("-srate");
       Commendf.add ("22050");
       Commendf.add ("-OVC");
       Commendf.add ("LAVC");
        Commendf.add ("-lavcopts"); Commendf.add ("vcodec=flv:vbitrate=480:mbd=2:v4mv:turbo:vb_strategy=1:last_pred=2:trell ");
       Commendf.add ("-VF");
       Commendf.add ("scale=400:226");
       Commendi.add ("F://mencoder//summer//ffmpeg.exe");
       Commendi.add ("I");
       Commendi.add (Oldfilepath);
       Commendi.add ("Y");
       Commendi.add ("F");
       Commendi.add ("Image2");
       Commendi.add ("-ss");
       Commendi.add ("8");
       Commendi.add ("-t");
       Commendi.add ("0.001");
       Commendi.add ("-S");
       Commendi.add ("100x100");
       Commendi.add (NEWIMG);
           try {processclass.exec (COMMENDF);
           Processclass.exec (Commendi);
       return true;
           catch (Exception e) {e.printstacktrace ();
       return false;
       } public static void Main (string[] args) {String Oldfilepath = "F://shanghaitan.rm";
       String newfilename = "f://shanghaitan.flv";
       String newimg = "F://shanghaitan.jpg";
       System.out.println ("--------------");
      ProcessTransToImg2 (OLDFILEPATH,NEWFILENAME,NEWIMG); System.out.println ("over");
}}---------------------package national;
Import java.io.IOException;
Import java.util.ArrayList;
Import Java.util.Iterator;
Import java.util.List;
  public class processclass{Public list<string> commendlist = new arraylist<string> ();
  Public Processclass (list<string> commendlist) {this.commendlist = commendlist;
      //sync allows only one process to execute the method (to perform a screenshot process when the format conversion process completes) public static synchronized Process exec (list<string> commendlist) {
      StringBuffer strbuf = new StringBuffer (); For (iterator Iter =commendlist.iterator (); Iter.hasnext ();)
         {String strtemp = (string) iter.next ();
         Strbuf.append (strtemp);
      Strbuf.append ("");
    try {return runtime.getruntime (). EXEC (strbuf.tostring ());
       catch (IOException e) {e.printstacktrace ();
    return null; }
  }
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.