Java Generate video thumbnails (FFmpeg) < fifth >

Source: Internet
Author: User

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 >

Related Article

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.