1、 安装nginx
nginx
nginx-rtmp-module:
官网:https://github.com/arut/nginx-rtmp-module
增加:http_ssl_module:
configure --add-module=<path-to-nginx-rtmp-module> --with-http_ssl_module
make
sudo make install
2、编译ffmpeg
ffmpeg
x264:http://www.videolan.org/developers/x264.html
先编译 x264
./configure --enable-static
make
sudo make install
编译ffmpeg
./configure --enable-libx264 --enable-gpl
3、启动
启动nginx
sudo /user local/nginx/sbin/nginx
ffmpeg 切片
本地文件:
ffmpeg -i 文件 -c:v libx264 -c:a aac -strict -2 -f hls /html/test.m3u8
ts流:
ffmpeg -i udp://@:1234 -c:v libx264 -c:a aac -strict -2 -f hls /html/test.m3u8
4、vlc 测试
打开网络串流
http://192.168.12.205/test.m3u8
如果不出差错便可以观看
本文详细介绍如何通过安装配置Nginx及Nginx RTMP模块,并结合FFmpeg实现音视频流媒体服务的搭建过程。从环境准备到具体步骤,包括Nginx的安装与配置、FFmpeg的编译与使用、测试播放等关键环节均有涉及。
530





