Using player + Nginx to build a VOD Server solves the problem of slow drag loading.

Source: Internet
Author: User
Tags flv file

[Switch] using player + Nginx to build a VOD Server solves the problem of slow drag loading.

FlvVideos can be published in two ways:
I. Common HTTP download Methods
Ii. rtmp/rtmpt stream Media mode based on Flash Media Server or Red5 Server.

Most well-known video websites use the previous method.
The two methods are compared as follows:
Http:After the key frame is generated, you can drag and play the video, and the server resources are no longer consumed after the download is complete.
Rtmp/rtmpt:Drag playback and cache-free playback consume server resources each time.



Here we will talk about how to use nginx to build an on-demand video-on-demand server in http mode. There are three steps:
I,NginxInstallation and configuration
1. download the latest nginx win32 version and decompress it to any directory.
2. open cmd to enter the nginx directory, and run start nginx to start nginx (\ conf \ nginx is used by default. conf configuration. You can use the-c option to specify the configuration file to be used. For more parameters, see nginx-h)
II,NginxSupport for flv
1. Edit the configuration file \ conf \ nginx. conf and add the following Configuration:
Add the configuration for starting gzip in the http Block
Gzip on;
Gzip_min_length 1100;
Gzip_buffers 4 8 k;
Gzip_types text/plain;
Add the flv-enabled configuration to the server block:
Limit_rate_after 1 m; # The speed limit starts after 1 M is downloaded.
Limit_rate 100 k; # limit the speed to 100 k/s
Location ~ \. Flv {
Flv;
}
2. Run the nginx-s reload command to reload the configuration file.
III,Client player
1. Download the open-source flash Player player
2. decompress the file to the html directory under nginx.
3. Access http: // localhot/player.swf? Type = http & file = 1. flv to play the video

Note: The video can be played now, but the drag function is not supported. Because "key frames" are not added to the flv file, the tools available are "yamdi" and "flvtool ", take the version of yamdi win32 as an example. Download and unzip the package and run the following command in cmd:
Yamdi-I src. flv-o dst. flv
This means to add a key frame to src. flv and output it as dst. flv.
OK. Then we can access http: // localhot/player.swf? Type = http & file = dst. flv.

 

Source: http://www.eoeandroid.com/forum.php? Mod = viewthread & tid = 313997.

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.