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