FLV video is already the majority of video sites preferred video type, domestic and foreign famous video sharing station YouTube, Youku, potatoes, Sina Blog, Qiyi and so on are all Flash Player Flv/mp4 video.
FLV has two modes of publishing
One, ordinary HTTP way: This method usually needs to download to the local to play, there is buffering, but the download will not occupy the server resources.
Second, streaming media mode: No need to download, can play in real time arbitrary drag and drop progress, user experience good but very consuming server resources.
Installing modules
Add the FLV stream module to the Nginx when compiling the installation
Copy Code code as follows:
./configure--user=www--group=www--prefix=/usr/local/webserver/nginx--with-http_flv_module
Make && make install
Open flv
Copy Code code as follows:
Server
{
Listen 80;
server_name flv.qttc.net;
Index index.html;
Root/web_root/flv_files;
Limit_rate_after 5m;
Limit_rate 1m;
Location ~ \.flv
{
flv
}
Access_log off;
}
Save the reboot just fine.
Parameter description:
Copy Code code as follows:
Limit_rate_after 5m # starts loading unlimited speed until download FLV video size exceeds 5M.
Limit_rate 1m # When more than 5m start to limit the speed of 1m/s download.
The general user just opened the video file need to download a lot of bytes in advance, so that side of the download without waiting for the buffer, without affecting the user experience can save many bandwidth, the two values to fine-tune according to the actual situation.
Drag and drop implementation
Drag-and-drop progress is a frequently triggered behavior of the user, the default FLV does not support drag, if you want to implement this feature requires the installation of additional plug-in modules to achieve. You need to write keyframe information to metadata when making flv.
There are many tools for adding keyframes, such as Yamdi, FlvTool2, and so on, and how to add keyframes can be found in the community of these tools. But in any case is the number of seconds per frame to achieve, the more frames the more smooth, but time-consuming and long, played in the Flash know.