Chinaunix首页 | 论坛 | 博客
  • 博客访问: 29448
  • 博文数量: 1
  • 博客积分: 45
  • 博客等级: 民兵
  • 技术积分: 35
  • 用 户 组: 普通用户
  • 注册时间: 2011-11-21 10:45
文章分类

全部博文(1)

文章存档

2012年(1)

我的朋友

分类: LINUX

2012-11-30 11:51:47

整了很久,mp4流媒体播放这方面资料很少,捣鼓了N天,刚申请开通CSDN博客,准备发表一下,共享给那些跟我一样苦逼找资料的兄弟们,TMD CSDN居然说“开通博客三天内不允许发表文章” CSDN肯定被黑怕了!!

系统版本:centos 6.3 其他系统版本应该也可以
应用软件:Nginx -1.1.3 //安装Nginx 1.1.3 此版本新增HTTP MP4 模块,可以google下载
nginx_mod_h264_streaming-2.2.7.tar.gz //支持MP4的模块,下载链接: ,也可以google下载
tar -xzvf nginx_mod_h264_streaming-2.2.7.tar.gz
cd nginx_mod_h264_streaming-2.2.7
修改Makefile文件中NGINX项的值为NGINX=$(HOME)/nginx-1.1.3/ ,nginx-1.1.3为你安装的nginx的版本
tar -xzvf nginx-1.1.3.tar.gz
cd nginx-1.1.3
./configure --add-module=/data/nginx_mod_h264_streaming-2.2.7 --prefix=/usr/local/nginx/ --with-http_flv_module --with-http_mp4_module
/data/nginx_mod_h264_streaming-2.2.7为你解压的nginx_mod_h264_streaming-2.2.7.tar.gz后的目录
make && make install
若报错:
vim /data/nginx_mod_h264_streaming-2.2.7/src/ngx_http_streaming_module.c
以下
TODO: Win32
if (r->zero_in_uri)
{
return NGX_DECLINED;
}
改成
/*
TODO: Win32
if (r->zero_in_uri)
{
return NGX_DECLINED;
}
*/
目的是注释这些地方

vim /usr/local/nginx/conf/nginx.conf
server里面加入

location / {
root html;
index index.html index.htm index.php default.php;
}

location ~* .*.mp4$ {
mp4;
}
location ~* .flv$ {
flv;
}
网页内嵌mp4播放代码mp4.html,mp4.html位于/usr/local/nginx/html目录下:

autostart="false" loop="true" width="800" height="500">

video/uploads/201211/1.mp4 是你的mp4文件位置,我的位于/usr/local/nginx/html/video/uploads/201211/1.mp4 ,/usr/local/nginx/html/是你nginx配置文件指定的web根目录
最后观看视频地址http://服务器ip地址或域名/mp4.html
可能客户端本地要安装realplayer播放器

阅读(21089) | 评论(0) | 转发(1) |
1

上一篇:没有了

下一篇:没有了

给主人留下些什么吧!~~