Ec (2); after the Ffmpeg file is downloaded, configure the environment variables. I downloaded the environment variables on the D Drive and Directory D: oracleproduct10.2.0client _ 1bin; D: oracleproduct10.2.0db _ 1bin; % SystemRoot % system32; % SystemRoot % System32Wbem; C: ProgramFilesJavajdk1. script ec (2); script
Ffmpeg
Get File
After the download, configure the environment variables.
I downloaded the ddisk and directory.
D: oracleproduct10.2.0client _ 1bin; D: oracleproduct10.2.0db _ 1bin; % SystemRoot % system32; % SystemRoot % System32Wbem; C: Program FilesJavajdk1.7.0bin; C: Program FilesATI javasiesati. ACECore-Static; C: Program FilesCommon FilesThunder NetworkKanKanCodecs; D: Program FilesTortoiseSVNbin; C: Program FilesMicrosoft SQL Server90Toolsbinn; D: ffmpeg
There are a lot of configuration items. The last one is my ffmpeg.
After the configuration, test it in Dos.
Open the Dos interface and enter ffmpeg.
If the command succeeds, many commands will be displayed.
If it fails, it indicates that you have not entered any internal commands.
If it fails, check whether your environment variable is configured OK.
Then, test whether the conversion is successful under Dos.
First, put a video in a directory.
I put the Demo. avi Video in drive D and directory, and I will convert it to Flv
Enter the command: ffmpeg-I D:/Demo. avi D:/Demo... flv
-I is followed by the file address to be converted, followed by the path to which you want to convert the file and the corresponding file name and format.
Enter the command and press enter to check whether the converted file exists in the corresponding directory.
If the command fails, check whether the command is correct.
Execute the conversion command in PHP
// Convert to Flv
Function makeFlv ($ video_file, $ flv_file)
{
// Determine whether the specified 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 flv video image
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 );
}