Configuring PHP.ini Files
Copy Code code as follows:
File_uploads = on;/whether to allow the switch to upload files over HTTP. The default is on, which is open
Upload_tmp_dir//files are uploaded to the server where temporary files are stored, and the system default temporary folder is used if unspecified
Upload_max_filesize = 1024m;//Look at the business, that is, the maximum size of the upload file allowed. The default is 2M, we set to 1G
Post_max_size = 1024m;//refers to the maximum value that can be received through the form post to PHP, we also set to 1G
Max_execution_time = 3600//php page run maximum time (seconds), default 30 seconds, set to one hour, because the back transcoding time is long.
Max_input_time = 36000;//The maximum time required for each PHP page to receive data, default 60 seconds
Memory_limit = 8m;//The maximum memory consumed by each PHP page, default 8M
File Upload Plugin
Flame rain recommended that you use Uploadify,uploadify is a jquery upload plugin, implementation with progress display. Plug-in installation is simple, skip here.
But there is a problem to note that non-IE browser session will be lost, the search for a lot of data, the final summary of the reasons are:
Because Uploadify uses a flash client, it produces useragent different from the user-agent of the browser.
Final Solution:
Copy Code code as follows:
Add the session parameter to the upmodify upload parameter as follows:
Scriptdata: {"session_id": "},
Add the following code to the server-side receive page:
if (@$_request[' session_id '] && ($session _id=$_request[' session_id '])!=session_id ()) {
Session_destroy ();
session_id ($session _id);
@session_start ();
}
This solves the problem that FLASH does not deliver pages correctly.
Video format Conversion
Now the popular video format conversion software under Linux is Ffmpeg,ffmpeg is a complete solution for recording, screenshots, converting and streaming audio and video, a leading audio/video codec class library. In addition to FFmpeg, we want to transfer the code into H264 format, we need an extension. (The article finally gives all package download addresses)
CentOS 5.4 Installation Source installation H264 extension
Copy Code code as follows:
TAR-XJVF x264-snapshot-20120718-2245-stable.tar.bz2
#进入解压后的源文件目录
CD x264-snapshot-20120718-2245-stable/
./configure--prefix=/usr/local--enable-shared
Make
Make install
CentOS 5.4 Installation Source installation ffmpeg with h264 extension
TAR-XJVF ffmpeg-2.1.1.tar.bz2
Enter the unpacked directory
CD ffmpeg-2.1.1
./configure--ENABLE-GPL--enable-libx264
Make
Make install
Reload Configuration
Lcfonfig
Test whether the installation was successful
Ffmpeg
If you see the following description of the installation success:
Copy Code code as follows:
FFmpeg version 2.1.1 Copyright (c) 2000-2013 the FFmpeg developers
Built on Dec 2013 23:32:40 with gcc 4.4.7 (gcc) 20120313 (Red Hat 4.4.7-3)
Configuration:--enable-libx264--ENABLE-GPL
Libavutil 52. 48.101/52. 48.101
Libavcodec 55. 39.101/55. 39.101
Libavformat 55. 19.104/55. 19.104
Libavdevice 55. 5.100/55. 5.100
Libavfilter 3. 90.100/3. 90.100
Libswscale 2. 5.101/2. 5.101
Libswresample 0. 17.104/0. 17.104
Libpostproc 52. 3.100/52. 3.100
Hyper fast Audio and Video encoder
usage:ffmpeg [Options] [[infile Options]-I infile] ... {[outfile options] outfile} ...
Use-h to get all help or, even better, run ' mans ffmpeg '
PHP calls ffmpeg transcoding video
Copy Code code as follows:
$cmd = ' ffmpeg-i uploadfile/video/test.wmv-c:v libx264-strict-2 uploadfile/mp4/test.mp4 ';
EXEC ($cmd, $status);
Verify that the EXEC function is turned on before running. Otherwise, modify the php.ini file
Finally attach ffmpeg+h264 extension +yasm+apache_mod_h264