您的位置:首页 > 运维架构 > Nginx

Smooth Streaming Module for Nginx

2015-08-05 13:01 696 查看


Dependencies

For more information on downloading and installing Nginx, please read the official ​getting
started instructions.

We will be using version 0.7.9 of Nginx.
cd ~
wget http://www.nginx.eu/download/sources/nginx-0.7.9.tar.gz tar zxvf nginx-0.7.9.tar.gz


Download

Download the source of the H264 Streaming Module for Nginx.
cd ~
wget http://h264.code-shop.com/download/nginx_mod_h264_streaming-2.2.0.tar.gz tar -zxvf nginx_mod_h264_streaming-2.2.0.tar.gz


If you plan to play Multi Bit Rate H.264 encoded videos, you will also need the command line tool 'mp4split' to create the Smooth Streaming manifest files.
wget http://h264.code-shop.com/download/mp4split-2.2.0.tar.gz tar -zxvf mp4split-2.2.0.tar.gz


Build

Run configure in the Nginx directory with the following additions to the commandline.
cd ~/nginx-0.7.9
./configure --add-module=$HOME/nginx_mod_h264_streaming --sbin-path=/usr/local/sbin --with-debug


Make and install Nginx.
make
sudo make install

cd ~/mp4split-2.2.0
./configure
make sudo make install


Configuration

Edit the configuration file (in /usr/local/nginx/conf/nginx.conf) so that file requests ending in '.mp4' and '.ismv' are handled by the 'mp4' command. Add the following lines in your 'server { ... }' section:
if ($is_args = "?") {
rewrite ^(.*)\.ism/manifest$ $1.mp4?manifest=1 last;
}
rewrite ^(.*)\.ism/Fragments\((.*)=([0-9]+)\)(.*)$ $1.mp4?$2=$3 last;
rewrite ^(.*)/(.*)\.ism/QualityLevels\(([0-9]+)\)/Fragments\((.*)=([0-9]+)\)(.*)$ $1/$2.ism/$2_$3.ismv?$4=$5 last;
rewrite ^(.*)\.ism/QualityLevels\(([0-9]+)\)/Fragments\((.*)=([0-9]+)\)(.*)$ $1.ism/$1_$2.ismv?$3=$4 last;

location ~ \.mp4$ {
mp4;
}
location ~ \.ismv$ {
mp4;
}


License

This version is free if you agree to the ​noncommercial
license. Please mention its use on your website, in the lines of 'This website uses H264 pseudo video streaming technology by​CodeShop'.

Our commercial license is very inexpensive, see the following page to check if you need a commercial
license.


Next

Encoding Smooth
Streaming videos.
Playing Smooth
Streaming videos.


Feedback

If you have any questions, thoughts or ideas on Smooth Streaming you can leave a message on our forum.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: