Dear all,
nginx.conf example
----------------------------------
location ~ \.mp4$ {
mp4;
}
----------------------------------
Best Regard,
Peng Wu
2008-10-08
--------------
Tech. VP
http://www.openv.com
26th Floor, Block 16, jianwai SOHO,
No.39 Middle East Third Ring Rd
Chaoyang District Beijing 100022
China
Tel: (010)5878 7828
Fax: (010)5878 7900
Email : wupeng at openv.cn
-------------------------------------------------------------
发件人：伍鹏
发送日期：2008-10-08 11:20:07
收件人：nginx at sysoev.ru
抄送：
主题：about h.264 streaming cache support
Dear all,
I have implemented an H.264 pseudo streaming module. And now I want to add cache feature to this module.
My situation is that we have some data centers across country, and each data center has some servers to provide video clips to our users. Because we want to simplify the management of the storage and video files synchronization problem, we maintain only one central storage. The servers on edge data centers should cache the most visited video clips based on LRU algorithm.
I read the ngx_httpd_proxy_module.c file, and I think it is a good starting point. I know a simplified module capable of this cache feature should work like this:
Step 1.if the requested file has been found on local disk, return the file
Step 2.if the requested file has not been found on local disk, proxy this request to original server and send the response to user and save the file to local disk.
I know I can implement Step 1 on ngx_http_proxy_handler function. For Step 2 I know I should create the proxy request on ngx_http_proxy_create_request function, but I do NOT know on which function I can save the response file to local disk and how. Should I implement this feature on ngx_http_proxy_finalize_request function? And which data structure contains the returned file data, is it u->buffering?
Thank you very much!
You can download the H.264 pseudo streaming module from http://218.244.191.134:8081/mp4.tar.bz2
compile & intall
1. wget http://218.244.191.134:8081/mp4.tar.bz2
2. tar xfj mp4.tar.bz2
3. mv mp4 your_path/nginx-0.7.17/src/http/modules
4. cd your_path/nginx-0.7.17
5. ./configure --with-http_flv_module --add-module=src/http/modules/mp4
6. make
7. make install
8. kill -HUP `cat /usr/local/nginx/logs/nginx.pid`
a simple demo
http://218.244.191.134:8081/playertest/mp4_streaming_nginx_test.html
Enjoy!
Best Regard,
Peng Wu
2008-10-08
--------------
Tech. VP
http://www.openv.com
26th Floor, Block 16, jianwai SOHO,
No.39 Middle East Third Ring Rd
Chaoyang District Beijing 100022
China
Tel: (010)5878 7828
Fax: (010)5878 7900
Email : wupeng at openv.cn