FFmpeg implementation of video format conversion and screenshots

Source: Internet
Author: User

Ffmpeg
Get the file

After the download, the first is to configure the environment variables

I downloaded it in the D disk and the catalogue.

d:oracleproduct10.2.0client_1bin;d:oracleproduct10.2.0db_1bin;%systemroot%system32;%systemroot%;%systemroot% System32wbem; C:Program Filesjavajdk1.7.0bin; C:Program Filesati technologiesati.acecore-static; C:Program FilesCommon filesthunder Networkkankancodecs;d:program filestortoisesvnbin; C:Program FilesMicrosoft SQL Server90toolsbinn;d:ffmpeg

It's a little bit more, and the last one is my ffmpeg.

After you've configured it, test it in DOS first.

Open the DOS interface input FFmpeg

If it succeeds, it will show a lot of orders.

If it fails, you are not entering an internal command or something.

If you fail, see if your environment variable is configured OK

OK after the test in DOS to successfully convert

First put a video in a directory

I put the Demo.avi video in the D disk and the directory and I'm going to convert to FLV

Input command: Ffmpeg-i D:/demo.avi D:/demo. flv

-I followed by the address of the file to be converted is where you want to convert the file and the corresponding file name and format

Enter the command and return to see if the corresponding directory appears with the converted file you need.

If the failure checks if the command is wrong.

command to perform transformations in PHP

Convert to FLV
function makeflv ($video _file, $flv _file)
{
To determine if a given file is normal
if (!is_file ($video _file)) {
return false;
}

Global $flv _msg;
$flv _cmd= "Ffmpeg-i". $video _file. " ". $flv _file;
EXEC ($flv _cmd, $flv _msg);
}

Create a picture of an FLV video
function Makeflvpic ($flv _file, $flv _pic_file)
{
Global $flv _msg;

$flv _pic_cmd= "Ffmpeg-i". $flv _file.
"-y-f Image2".
"-ss 1".
"-t 0.001".
"-S 350x240". $flv _pic_file;

EXEC ($flv _pic_cmd, $flv _msg);
}

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.