流媒体服务器搭建详解
2015-09-16 15:41
260 查看
1 安装nginx 要增加nginx-rtmp-module的支持 下载好nginx-rtmp-module后解压,然后nginx安装时增加这个模块(--add-module)
./configure --prefix=/usr/local/nginx --add-module=(nginx-rtmp-module路径)
2 安装完成后,打开Nginx的配置文件nginx.conf进行配置
首先在里面加入rtmp的配置
rtmp {
server {
listen 1935;
application video {
live on;
}
application hls {
live on;
hls on;
hls_path /tmp/hls;
}
}
}
然后,针对hls,还需要在http里面增加一个location配置
location /hls {
types {
application/vnd.apple.mpegurl m3u8;
video/mp2t ts;
}
root /tmp;
add_header Cache-Control no-cache;
}
保存完配置文件后,启动nginx,通过netstat -ltn命令可以看到增加了一个1935端口的监听.8080是nginx默认的http监听端口.
/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf 启动nginx 查看是否成功
3 安装ffmpeg 所需要源码包 yasm:http://yasm.tortall.net/Download.html
ffmpeg -re -i /app/test.mp4 -vcodec copy -vprofile baseline -ar 44100 -strict -2 -ac 1 -f flv -s 640x360 -q 10 rtmp://127.0.0.1:1935/hls/test4
./configure --prefix=/usr/local/nginx --add-module=(nginx-rtmp-module路径)
2 安装完成后,打开Nginx的配置文件nginx.conf进行配置
首先在里面加入rtmp的配置
rtmp {
server {
listen 1935;
application video {
live on;
}
application hls {
live on;
hls on;
hls_path /tmp/hls;
}
}
}
然后,针对hls,还需要在http里面增加一个location配置
location /hls {
types {
application/vnd.apple.mpegurl m3u8;
video/mp2t ts;
}
root /tmp;
add_header Cache-Control no-cache;
}
保存完配置文件后,启动nginx,通过netstat -ltn命令可以看到增加了一个1935端口的监听.8080是nginx默认的http监听端口.
/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf 启动nginx 查看是否成功
3 安装ffmpeg 所需要源码包 yasm:http://yasm.tortall.net/Download.html
ffmpeg -re -i /app/test.mp4 -vcodec copy -vprofile baseline -ar 44100 -strict -2 -ac 1 -f flv -s 640x360 -q 10 rtmp://127.0.0.1:1935/hls/test4
相关文章推荐
- 短网址服务的构建
- 查内网虚拟机映射的公网IP
- 大数据笔记01:大数据之Hadoop简介
- Activity的生命周期onSaveInstanceState onRestoreInstanceState 两个方法
- 带界面的基于UDP传输多人聊天例子
- 在Linux下用scp复制文件无需输入密码的技巧
- Graphviz和Pvtrace工具在Ubuntu下安装
- 完美解决VX破解版本过期后重装无法使用的情况
- Algorithms—87.Scramble String
- 跨域解决方案
- PHP常用函数大全
- Android开发-通过ADB+Socket实现USB数据传输
- Android:控件WebView显示网页
- 绪论
- win7串口可以发送数据无法接收数据
- 可变长度结构
- cmake编译参数
- 音乐的免费时代的终结者?
- mfc如何快速实现无边框窗口阴影效果
- linux基础二