记录一下搭建rtmp服务器过程
参考:https://zhuanlan.zhihu.com/p/28009037
//www.greatytc.com/p/06c2025edcd3
在Ubuntu环境下进行搭建
下载nginx和nginx module和安装依赖
git clone https://github.com/arut/nginx-rtmp-module.git
wget http://nginx.org/download/nginx-1.8.1.tar.gz
sudo apt-get update
sudo apt-get install libpcre3 libpcre3-dev
sudo apt-get install openssl libssl-dev
编译
cd nginx-1.8.1
./configure --add-module=../nginx-rtmp-module
make
sudo make install
配置nginx.conf文件直播
rtmp {
server {
listen 1935;
application videotest{
live on;
}
}
}
启动nginx服务器
sudo /usr/local/nginx/sbin/nginx
ffmpeg推流mp4
ffmpeg -re -i video.mp4 -vcodec copy -acodec copy -b:v 800k -b:a 32k -f flv rtmp://192.168.56.101/videotest
ffmpeg推流dshow
ffmpeg -fflags nobuffer -f dshow -i audio="麦克风 (USB Audio Device)" -acodec aac -f flv rtmp://192.168.56.101/videotest
vlc播放
rtmp://192.168.56.101/videotest