FFmpeg is used to generate thumbnails for uploading videos.
On the Internet to find how to compile FFmpeg method
But it feels so complicated.
I found the compiled ffmpeg file on the csdn.
Download it down
Give everyone A
http://download.csdn.net/source/453719
Experience the FFmpeg is very powerful, most popular video formats can generate thumbnails
Start now
First download FFmpeg decompression
Create a BAT file
Start E:/ffmpeg/bin/ffmpeg.exe-i%1-ss 20-vframes 1-r 1-ac 1-ab 2-s 160*120-f image2%2 Exit |
Note the meaning of using the red bar mark
E:/ffmpeg/bin/ffmpeg.exe FFmpeg's Path
%1%2 and C languages are a bit similar to reserved locations for parameters
20 How many seconds to intercept the picture
Open MyEclipse, build a project, and a Java file
Package test; Import java.io.IOException; public class Ffmpeg { public static void Main (string[] args) { Video files String Videorealpath = "f://instant. flv"; The path (output path) String Imagerealpath = "F://a.jpg"; try { Calling a batch file Runtime.getruntime (). EXEC ("cmd/c start F://ffmpeg.bat" + Videorealpath + "" + Imagerealpath); } catch (IOException e) { TODO auto-generated Catch block E.printstacktrace (); } } } |
All right, run and try, you can see it under the F-drive.
Java Generate video thumbnails (FFmpeg) < fifth >