nginxではpsuedo streamingという途中再生が可能になる機能に対応している。
たとえば、ファイル名の後に ?start=60 を付けたら最初から1分後からの動画をリクエストできるようになっている。
これをiPhoneでも試してみようと思ったが、少し工夫が必要だったのでここに記載する。
iPhoneで再生可能なのはmp4ファイルで、videoがh.264、audioがaacだ。
Ngix&mp4ストリーミングモジュールインストール方法
①
cd /usr/local/src/ wget http://www.nginx.eu/download/sources/nginx-0.7.9.tar.gz tar zxvf nginx-0.7.9.tar.gz
②
cd /usr/local/src/ svn export http://h264.code-shop.com/svn/h264/tags/mod_h264_streaming-2.1rc2/nginx nginx_http_h264_streaming svn export --force http://h264.code-shop.com/svn/h264/tags/mod_h264_streaming-2.1rc2/mp4split nginx_http_h264_streaming
③
cd /usr/local/src/nginx-0.7.9
./configure --add-module=/usr/local/src/nginx_http_h264_streaming --sbin-path=/usr/local/sbin --with-debug
make
sudo make install
④
vi /usr/local/nginx/conf/nginx.conf
下記を追加(43行目ぐらい):
location ~ \.mp4$ { mp4; }
⑤起動
sudo /usr/local/sbin/nginx
-------------------------------------------------------------------------------------------------------
モジュールのSVN(iphone再生対応しているブランチ):
http://h264.code-shop.com/svn/h264/tags/mod_h264_streaming-2.1rc2/nginx
http://h264.code-shop.com/svn/h264/tags/mod_h264_streaming-2.1rc2/mp4split
参照:
http://h264.code-shop.com/trac/wiki/Mod-H264-Streaming-Nginx-Version2 - Nginxインスト方法
(ここに記載されているmod_h264_streamingはiPhone再生に対応していない)
http://h264.code-shop.com/trac/discussion/1/18 - iPhone range requestの件
http://h264.code-shop.com/trac/wiki/ReleaseNotes-Version2 iPhone range requestに対応しているバージョン

